32 const std::shared_ptr<ITensorRegistry> &tensor_reg)
33 : acl_common::AclConstantInitializer{operands, tensor_reg}
57 const auto &block_size_obj =
_operands.
at(block_size_index);
59 if (block_size_obj.isConstant())
61 _init_map[block_size_index] = acl_common::initReverseOrder<int32_t>;
65 const auto &paddings_obj =
_operands.
at(paddings_index);
66 if (paddings_obj.isConstant())
69 assert(model_obj.
data());
70 const auto &shape = model_obj.
shape();
71 const auto base =
reinterpret_cast<const int32_t *
>(model_obj.
data()->base());
72 assert(model_obj.
shape().rank() == 2);
73 assert(obj.getShape().dim(0) == 2);
74 obj.access([&](
ITensor &tensor) {
75 for (
auto i = 0; i < shape.dim(0); ++i)
77 for (
auto j = 0; j < shape.dim(1); ++j)
79 const int32_t value = base[i * 2 + j];
80 int32_t *into =
reinterpret_cast<int32_t *
>(
81 tensor.buffer() + tensor.calcOffset({shape.dim(0) - i - 1, j}));
98 const auto ifm_rank = input_obj.shape().rank();
100 if (axis_obj.isConstant())
103 assert(operand.
data());
105 const auto axis_value = *(
reinterpret_cast<const int32_t *
>(operand.
data()->base()));
106 int32_t axis_tmp = axis_value;
109 axis_tmp = axis_tmp + ifm_rank;
114 obj.access([&](
ITensor &tensor) {
115 int32_t *into =
reinterpret_cast<int32_t *
>(tensor.buffer());
116 *into = (int32_t)axis;
void visit(const ir::operation::EmbeddingLookup &) final
ConstantInitializer(const ir::Operands &operands, const std::shared_ptr< ITensorRegistry > &tensor_reg)
uint32_t value(void) const
std::unordered_map< ir::OperandIndex, Initializer > _init_map
void copyInputInitialize(const ir::Operation &node, uint32_t index)
const ir::Operands & _operands
const Shape & shape(void) const
void data(std::shared_ptr< Data > &&data)
const OperandIndex & at(IOIndex set_index) const
OperandIndexSequence & getInputs()
const Object & at(const Index &index) const
Get the object that is associated with the given index.
ARMComputeAxis ToARMComputeAxis(uint32_t rank, uint32_t axis)