46 ParsedTensors &parsed_tensors)
48 auto inputs = loco_graph.get()->inputs();
49 auto outputs = loco_graph.get()->outputs();
50 uint32_t input_idx = 0;
51 uint32_t output_idx = 0;
52 for (
auto &parsed_tensor : parsed_tensors)
56 if (!parsed_tensor->hasShape())
58 auto input_shape = inputs->at(input_idx++)->shape();
60 uint32_t
size = input_shape->rank();
61 parsed_tensor->mutable_shape().resize(
size);
62 for (uint32_t d = 0; d <
size; d++)
64 parsed_tensor->mutable_shape().dim(d) = input_shape->dim(d).value();
67 _inputs.emplace_back(std::move(parsed_tensor));
71 if (!parsed_tensor->hasShape())
77 for (uint32_t d = 0; d <
size; d++)
79 parsed_tensor->mutable_shape().dim(d) =
output_shape->dim(d).value();
82 _outputs.emplace_back(std::move(parsed_tensor));
94 for (
auto &parsed_tensor : parsed_tensors)
104 if (parsed_tensor->hasShape())
105 sig.
shape(parsed_tensor->name(), parsed_tensor->shape());
118 _loco_graph = std::move(loco_graph);
119 _sess = std::make_unique<locomotiv::Session>(_loco_graph.get());
129 std::vector<std::unique_ptr<Buffer<float>>> buf_list;
131 for (
int n = 0; n < _inputs.size(); n++)
133 auto buf = make_buffer<float, LexicalLayout>(_inputs.at(n)->shape());
142 for (
int n = 0; n < buf_list.size(); n++)
144 auto buf = buf_list.at(n).get();
146 _sess->set_input(n, std::move(node_data));
Class for the context of output tensors.