Replace uses of `IObject` with `ITensor` in `ConstantInitializer`.
Signed-off-by: Sergei Barannikov <s.barannikov@samsung.com>
if (block_size_obj.isConstant())
{
_init_map[block_size_index] = [](const model::Operand &model_obj,
- backend::operand::IObject &obj) {
+ backend::operand::ITensor &obj) {
const auto &shape = model_obj.shape();
const auto base = reinterpret_cast<const int32_t *>(model_obj.data().base());
assert(model_obj.shape().rank() == 1);
if (block_size_obj.isConstant())
{
_init_map[block_size_index] = [](const model::Operand &model_obj,
- backend::operand::IObject &obj) {
+ backend::operand::ITensor &obj) {
const auto &shape = model_obj.shape();
const auto base = reinterpret_cast<const int32_t *>(model_obj.data().base());
assert(model_obj.shape().rank() == 1);
if (paddings_obj.isConstant())
{
_init_map[paddings_index] = [](const model::Operand &model_obj,
- backend::operand::IObject &obj) {
+ backend::operand::ITensor &obj) {
const auto &shape = model_obj.shape();
const auto base = reinterpret_cast<const int32_t *>(model_obj.data().base());
assert(model_obj.shape().rank() == 2);
- assert(obj.ptr()->dimension(0) == 2);
+ assert(obj.dimension(0) == 2);
obj.access([&](::neurun::backend::operand::ITensor &tensor) {
for (auto i = 0; i < shape.dim(0); ++i)
{
if (block_size_obj.isConstant())
{
_init_map[block_size_index] = [](const model::Operand &model_obj,
- backend::operand::IObject &obj) {
+ backend::operand::ITensor &obj) {
const auto &shape = model_obj.shape();
const auto base = reinterpret_cast<const int32_t *>(model_obj.data().base());
assert(model_obj.shape().rank() == 1);
if (block_size_obj.isConstant())
{
_init_map[block_size_index] = [](const model::Operand &model_obj,
- backend::operand::IObject &obj) {
+ backend::operand::ITensor &obj) {
const auto &shape = model_obj.shape();
const auto base = reinterpret_cast<const int32_t *>(model_obj.data().base());
assert(model_obj.shape().rank() == 1);
if (paddings_obj.isConstant())
{
_init_map[paddings_index] = [](const model::Operand &model_obj,
- backend::operand::IObject &obj) {
+ backend::operand::ITensor &obj) {
const auto &shape = model_obj.shape();
const auto base = reinterpret_cast<const int32_t *>(model_obj.data().base());
assert(model_obj.shape().rank() == 2);
template <typename T>
static void PermuteKernel(const neurun::model::Operand &model_obj,
- neurun::backend::operand::IObject &obj,
+ neurun::backend::operand::ITensor &obj,
const std::vector<int32_t> &permutation)
{
const auto shape = model_obj.shape();
namespace
{
template <typename T>
-static void Init(const neurun::model::Operand &model_obj, neurun::backend::operand::IObject &obj,
+static void Init(const neurun::model::Operand &model_obj, neurun::backend::operand::ITensor &obj,
const bool copy,
const neurun::model::Layout frontend_layout = neurun::model::Layout::UNKNOWN)
{
}
template <typename T>
-void copyInit(const neurun::model::Operand &model_obj, neurun::backend::operand::IObject &obj)
+void copyInit(const neurun::model::Operand &model_obj, neurun::backend::operand::ITensor &obj)
{
Init<T>(model_obj, obj, true);
}
template <typename T>
-void permuteInit(const neurun::model::Operand &model_obj, neurun::backend::operand::IObject &obj,
+void permuteInit(const neurun::model::Operand &model_obj, neurun::backend::operand::ITensor &obj,
const neurun::model::Layout frontend_layout)
{
- const bool copy = frontend_layout == obj.ptr()->layout();
+ const bool copy = frontend_layout == obj.layout();
Init<T>(model_obj, obj, copy, frontend_layout);
}
const auto &fn = it.second;
const auto &model_obj = operands().at(ind);
- auto tensor_obj = tensor_builder()->wrapTensor(ind);
+ auto tensor_obj = tensor_builder()->tensorAt(ind);
fn(model_obj, *tensor_obj);
VERBOSE(FillOperandData) << "Fill data for operand " << ind.value() << std::endl;
}
}
public:
- using Initializer = std::function<void(const model::Operand &, backend::operand::IObject &)>;
+ using Initializer = std::function<void(const model::Operand &, backend::operand::ITensor &)>;
void generate(const model::Subgraph &subg, const model::Operands &operands)
{