30 const auto &inputs = args.op.inputs;
31 const auto *options = args.op.builtin_options.AsWhileOptions();
33 if (inputs.size() != args.op.outputs.size())
36 auto num_graphs =
static_cast<int32_t
>(args.reader.num_subgraph());
37 if (options->cond_subgraph_index >= num_graphs)
39 if (options->body_subgraph_index >= num_graphs)
64 assert(context !=
nullptr);
66 auto graph = context->
graph();
68 const std::vector<int32_t> &inputs = op.inputs;
69 const std::vector<int32_t> &outputs = op.outputs;
73 std::vector<CircleNode *> input_nodes;
74 for (
const int32_t input_tensor_index : inputs)
81 uint32_t input_count = inputs.size();
82 uint32_t output_count = outputs.size();
87 for (uint32_t idx = 0; idx < input_count; ++idx)
89 node->
input(idx, input_nodes[idx]);
92 const auto *options = op.builtin_options.AsWhileOptions();
96 assert(outputs.size() > 0);
99 const auto output_tensor = tensors[outputs[0]];
100 assert(output_tensor !=
nullptr);
102 assert(opcodes[op.opcode_index] !=
nullptr);
103 node->
op_version(opcodes[op.opcode_index]->version());
109 for (uint32_t n = 0; n < output_count; ++n)
111 const auto output_tensor = tensors[outputs[n]];
112 assert(output_tensor !=
nullptr);
116 nodeout->
input(node);
Class to store context to build loco graph IR from TensorFlow.
IndexNodeFinder * nodefinder()
void copy_tensor_attributes(const circle::Tensor *tensor, CircleNode *node)
Copy common tensor attributes such as name, type, etc. to node.