Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement getter functions for ETFeeder #176

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading