Replace uses of `IObject` with `ITensor` in `OperandContext`.
Signed-off-by: Sergei Barannikov <s.barannikov@samsung.com>
for (auto &tensor_builder : tensor_builders)
{
tensor_builder->iterate([&](const model::OperandIndex &index) {
- auto object = tensor_builder->wrapTensor(index);
+ auto object = tensor_builder->tensorAt(index);
operand_context->set(index, object);
});
}
for (auto &tensor_builder : tensor_builders)
{
tensor_builder->iterate([&](const model::OperandIndex &index) {
- auto object = tensor_builder->wrapTensor(index);
+ auto object = tensor_builder->tensorAt(index);
operand_context->set(index, object);
});
}
{
OperandContext &OperandContext::set(const model::OperandIndex &id,
- const std::shared_ptr<backend::operand::IObject> &object)
+ const std::shared_ptr<backend::operand::ITensor> &tensor)
{
- // Only one object for an id
- assert(_objects.find(id) == _objects.end());
- _objects[id] = object;
+ // Only one tensor for an id
+ assert(_tensors.find(id) == _tensors.end());
+ _tensors[id] = tensor;
return (*this);
}
void OperandContext::iterate(
- const std::function<void(const model::OperandIndex &, backend::operand::IObject &)> &fn)
+ const std::function<void(const model::OperandIndex &, backend::operand::ITensor &)> &fn)
{
- for (auto &e : _objects)
+ for (auto &e : _tensors)
{
fn(e.first, *e.second);
}
#ifndef __NEURUN_COMPILER_OPERAND_CONTEXT_H__
#define __NEURUN_COMPILER_OPERAND_CONTEXT_H__
-#include "backend/operand/IObject.h"
+#include "backend/operand/ITensor.h"
#include "model/OperandIndexMap.h"
#include <unordered_map>
#include <memory>
{
public:
OperandContext &set(const model::OperandIndex &ind,
- const std::shared_ptr<backend::operand::IObject> &object);
+ const std::shared_ptr<backend::operand::ITensor> &tensor);
public:
bool exist(const ::neurun::model::OperandIndex &ind) const
{
- return _objects.find(ind) != _objects.end();
+ return _tensors.find(ind) != _tensors.end();
}
public:
- std::shared_ptr<backend::operand::IObject> at(const model::OperandIndex &ind) const
+ std::shared_ptr<backend::operand::ITensor> at(const model::OperandIndex &ind) const
{
- return _objects.at(ind);
+ return _tensors.at(ind);
}
- std::shared_ptr<backend::operand::IObject> &at(const model::OperandIndex &ind)
+ std::shared_ptr<backend::operand::ITensor> &at(const model::OperandIndex &ind)
{
- return _objects.at(ind);
+ return _tensors.at(ind);
}
void
- iterate(const std::function<void(const model::OperandIndex &, backend::operand::IObject &)> &fn);
+ iterate(const std::function<void(const model::OperandIndex &, backend::operand::ITensor &)> &fn);
private:
- model::OperandIndexMap<std::shared_ptr<backend::operand::IObject>> _objects;
+ model::OperandIndexMap<std::shared_ptr<backend::operand::ITensor>> _tensors;
};
} // namespace compiler
const auto operand_index = _graph.getInputs().at(index);
const auto &operand = _graph.operands().at(operand_index);
- const auto tensor = _operand_context->at(operand_index)->ptr();
+ const auto tensor = _operand_context->at(operand_index);
const auto tensor_layout = tensor->layout();
if (((io_layout == model::Layout::NHWC) && (tensor_layout == model::Layout::NCHW)) ||
{
const auto operand_index = _graph.getOutputs().at(index);
const auto &operand = _graph.operands().at(operand_index);
- const auto tensor = _operand_context->at(operand_index)->ptr();
+ const auto tensor = _operand_context->at(operand_index);
const auto tensor_layout = tensor->layout();
if (((tensor_layout == model::Layout::NCHW) && (io_layout == model::Layout::NHWC)) ||