This commit allows to have multi objects in an one index.
It's for objects of heterogeneous backends in an one index.
Signed-off-by: sjsujinkim <sjsujin.kim@samsung.com>
for (auto it = _initializer_ctx.begin(); it != _initializer_ctx.end(); ++it)
{
const ::internal::tflite::operand::Index operand_index{it->first};
- _plan.operands().at(operand_index).access(it->second);
+ auto objects = _plan.operands().at(operand_index);
+
+ for (auto object : objects)
+ {
+ object->access(it->second);
+ }
}
}
{
auto setter = [&](::arm_compute::ITensor &tensor) { execution->source(n).push(tensor); };
- plan.operands().at(model.inputs.at(n)).access(setter);
+ auto objects = plan.operands().at(model.inputs.at(n));
+
+ for (auto object : objects)
+ {
+ object->access(setter);
+ }
}
const auto &operations = execution->plan().operations();
{
auto getter = [&](::arm_compute::ITensor &tensor) { execution->sink(n).pull(tensor); };
- plan.operands().at(model.outputs.at(n)).access(getter);
+ auto objects = plan.operands().at(model.outputs.at(n));
+
+ for (auto object : objects)
+ {
+ object->access(getter);
+ }
}
return ANEURALNETWORKS_NO_ERROR;
Context &Context::set(const ::internal::tflite::operand::Index &id,
const std::shared_ptr<::internal::IObject> &object)
{
- assert(_objects.find(id.asInt()) == _objects.end());
-
- _objects[id.asInt()] = object;
+ _objects[id.asInt()].emplace_back(object);
return (*this);
}
}
public:
- const ::internal::IObject &at(const ::internal::tflite::operand::Index &ind) const
+ const std::vector<std::shared_ptr<IObject>> &
+ at(const ::internal::tflite::operand::Index &ind) const
{
- return *_objects.at(ind.asInt());
+ return _objects.at(ind.asInt());
}
- ::internal::IObject &at(const ::internal::tflite::operand::Index &ind)
+ std::vector<std::shared_ptr<IObject>> &at(const ::internal::tflite::operand::Index &ind)
{
- return *_objects.at(ind.asInt());
+ return _objects.at(ind.asInt());
}
private:
- std::map<int, std::shared_ptr<IObject>> _objects;
+ std::map<int, std::vector<std::shared_ptr<IObject>>> _objects;
};
} // namespace operand