void TfliteImporter::walkGraphAndCreateMIR()
{
walkModel(_modelPacked);
- setIrNodeNames();
setGraphOutputs();
}
input_shape.dim(dim) = t->shape()->Get(dim);
}
- auto input = _graph->create<mir::ops::InputOp>(t->name()->c_str(), input_shape)->getOutput(0);
-
+ auto input = _graph->create<mir::ops::InputOp>(input_shape)->getOutput(0);
input->setName(t->name()->c_str());
assert(_tensorMap.find(i) == _tensorMap.cend());
_tensorMap[i] = input;
{
assert(_tensorMap.find(i) == _tensorMap.end());
mir::TensorVariant mir_tensor = createTensor(tensor, buffer);
- inputs.emplace_back(_graph->create<ops::ConstantOp>("", mir_tensor)->getOutput(0));
+ inputs.emplace_back(_graph->create<ops::ConstantOp>(mir_tensor)->getOutput(0));
}
else
{
for (auto output_idx : _graphOutputs)
{
auto output = _tensorMap[output_idx];
- _graph->create<mir::ops::OutputOp>(output->getNode()->getName(), output);
- output->getNode()->setName("");
- }
-}
-
-void TfliteImporter::setIrNodeNames()
-{
- // Setting names of the nodes.
- // Note: we change the computation graph, (for example, TFLite Conv2D
- // turns into IR Conv2D->Add->ReLU), so not all of the nodes will have names.
- for (auto iter : _tensorMap)
- {
- const Tensor *tensor = (*_tensors)[iter.first];
- iter.second->getNode()->setName(tensor->name()->c_str());
+ _graph->create<mir::ops::OutputOp>(output);
}
}
template <typename OpType, typename... Types>
mir::Operation *TFLiteOpCreator::createOp(Types &&... args)
{
- // TODO: how to name operations? in Tensorflow tensors get names, not operations
- return _graph->create<OpType>("", std::forward<Types>(args)...);
+ return _graph->create<OpType>(std::forward<Types>(args)...);
}
} // namespace mir_tflite