Skip to content

Commit

Permalink
Implement getter functions for nodes' inputs/outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
JoongunPark committed Dec 2, 2024
1 parent addf3db commit 640de25
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 0 deletions.
54 changes: 54 additions & 0 deletions src/feeder/et_feeder_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,18 @@ ETFeederNode::ETFeederNode(std::shared_ptr<ChakraProtoMsg::Node> node) {
this->runtime_ = node->duration_micros();
this->is_cpu_op_ = 1;

if (node->has_inputs()) {
this->inputs_values_ = static_cast<string>(node->inputs().values());
this->inputs_shapes_ = static_cast<string>(node->inputs().shapes());
this->inputs_types_ = static_cast<string>(node->inputs().types());
}

if (node->has_outputs()) {
this->outputs_values_ = static_cast<string>(node->outputs().values());
this->outputs_shapes_ = static_cast<string>(node->outputs().shapes());
this->outputs_types_ = static_cast<string>(node->outputs().types());
}

for (const auto& attr : node->attr()) {
const string& attr_name = attr.name();

Expand Down Expand Up @@ -144,3 +156,45 @@ uint32_t ETFeederNode::comm_tag() {
string ETFeederNode::pg_name() {
return pg_name_;
}

string ETFeederNode::get_inputs_values() const {
if (node_->has_inputs()) {
return inputs_values_;
}
return "";
}

string ETFeederNode::get_inputs_shapes() const {
if (node_->has_inputs()) {
return inputs_shapes_;
}
return "";
}

string ETFeederNode::get_inputs_types() const {
if (node_->has_inputs()) {
return inputs_types_;
}
return "";
}

string ETFeederNode::get_outputs_values() const {
if (node_->has_outputs()) {
return outputs_values_;
}
return "";
}

string ETFeederNode::get_outputs_shapes() const {
if (node_->has_outputs()) {
return outputs_shapes_;
}
return "";
}

string ETFeederNode::get_outputs_types() const {
if (node_->has_outputs()) {
return outputs_types_;
}
return "";
}
12 changes: 12 additions & 0 deletions src/feeder/et_feeder_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ class ETFeederNode {
uint32_t comm_dst();
uint32_t comm_tag();
std::string pg_name();
std::string get_inputs_values() const;
std::string get_inputs_shapes() const;
std::string get_inputs_types() const;
std::string get_outputs_values() const;
std::string get_outputs_shapes() const;
std::string get_outputs_types() const;

private:
void assign_attr_val(
Expand Down Expand Up @@ -67,6 +73,12 @@ class ETFeederNode {
uint32_t comm_dst_;
uint32_t comm_tag_;
std::string pg_name_;
std::string inputs_values_;
std::string inputs_shapes_;
std::string inputs_types_;
std::string outputs_values_;
std::string outputs_shapes_;
std::string outputs_types_;
};

} // namespace Chakra

0 comments on commit 640de25

Please sign in to comment.