for (auto i : *s->inputs())
{
- const Tensor *t = (*s->tensors())[i];
+ const Tensor *t = (*_tensors)[i];
mir::Shape input_shape(t->shape()->size());
for (int dim = 0; dim < t->shape()->size(); ++dim)
input_shape.dim(dim) = t->shape()->Get(dim);
}
- auto input = _graph->create<mir::ops::InputOp>(t->name()->c_str(), input_shape);
- _tensorMap[i] = input->getOutput(0);
+ auto input = _graph->create<mir::ops::InputOp>(t->name()->c_str(), input_shape)->getOutput(0);
+
+ input->setName(t->name()->c_str());
+ assert(_tensorMap.find(i) == _tensorMap.cend());
+ _tensorMap[i] = input;
}
for (auto op : *(s->operators()))
assert(outputs.size() == op->outputs()->size());
for (size_t i = 0; i < op->outputs()->size(); ++i)
{
- int32_t tensor_index = (*op->outputs())[i];
+ const int32_t tensor_index = (*op->outputs())[i];
+ const Tensor *tensor = (*_tensors)[tensor_index];
+
+ outputs[i]->setName(tensor->name()->c_str());
+ assert(_tensorMap.find(tensor_index) == _tensorMap.cend());
_tensorMap[tensor_index] = outputs[i];
}
}
std::vector<int32_t> _graphOutputs;
// Maps TFLite tensors indices to corresponding MIR operation outputs.
+ // FIXME Can the same id represent different tensors in different subgraphs?
std::map<int, mir::Operation::Output *> _tensorMap;
void import();