| 130 | } |
| 131 | |
| 132 | std::vector<py::dict> outputsPyArray(const luci::CircleNode *node, |
| 133 | luci_interpreter::Interpreter *interpreter) |
| 134 | { |
| 135 | std::vector<py::dict> outputs; |
| 136 | for (auto succ : loco::succs(node)) |
| 137 | { |
| 138 | const auto output_tensor = interpreter->getTensor(succ); |
| 139 | auto circle_node = static_cast<luci::CircleNode *>(succ); |
| 140 | |
| 141 | auto opcode_str = toString(circle_node->opcode()); |
| 142 | // Check if node is a multi-output node |
| 143 | // Assumption: Multi-output virtual nodes have 'Out' prefix |
| 144 | // TODO Fix this if the assumption changes |
| 145 | THROW_UNLESS(opcode_str.substr(opcode_str.length() - 3) == "Out", |
| 146 | "Invalid output detected in " + node->name()); |
| 147 | |
| 148 | auto py_output = |
| 149 | py::dict("name"_a = circle_node->name(), "data"_a = numpyArray(output_tensor), |
| 150 | "quantparam"_a = quantparam(output_tensor), |
| 151 | "is_const"_a = circle_node->opcode() == luci::CircleOpcode::CIRCLECONST); |
| 152 | outputs.push_back(py_output); |
| 153 | } |
| 154 | return outputs; |
| 155 | } |
| 156 | |
| 157 | // Note: Only returns 1 output |
| 158 | py::dict outputPyArray(const luci::CircleNode *node, luci_interpreter::Interpreter *interpreter) |
no test coverage detected