ONE - On-device Neural Engine
Loading...
Searching...
No Matches
onert::backend::cpu::ops::DynamicUpdateSliceLayer Class Reference

#include <DynamicUpdateSlice.h>

Collaboration diagram for onert::backend::cpu::ops::DynamicUpdateSliceLayer:

Public Member Functions

 DynamicUpdateSliceLayer ()
 
 ~DynamicUpdateSliceLayer ()
 
void configure (const IPortableTensor *operand, const IPortableTensor *update, const IPortableTensor *indices, IPortableTensor *output)
 
void run () override
 
- Public Member Functions inherited from onert::exec::IFunction
virtual ~IFunction ()=default
 
virtual void prepare ()
 

Detailed Description

Definition at line 28 of file DynamicUpdateSlice.h.

Constructor & Destructor Documentation

◆ DynamicUpdateSliceLayer()

onert::backend::cpu::ops::DynamicUpdateSliceLayer::DynamicUpdateSliceLayer ( )

Definition at line 25 of file DynamicUpdateSlice.cc.

26 : _operand(nullptr), _update(nullptr), _indices(nullptr), _output(nullptr)
27{
28 // DO NOTHING
29}

◆ ~DynamicUpdateSliceLayer()

onert::backend::cpu::ops::DynamicUpdateSliceLayer::~DynamicUpdateSliceLayer ( )
default

Member Function Documentation

◆ configure()

void onert::backend::cpu::ops::DynamicUpdateSliceLayer::configure ( const IPortableTensor operand,
const IPortableTensor update,
const IPortableTensor indices,
IPortableTensor output 
)

Definition at line 33 of file DynamicUpdateSlice.cc.

36{
37 assert(operand != nullptr);
38 assert(update != nullptr);
39 assert(indices != nullptr);
40 assert(output != nullptr);
41
42 _operand = operand;
43 _update = update;
44 _indices = indices;
45 _output = output;
46}
FeatureShapeUpdater update(loco::FeatureShape &feature_shape)

◆ run()

void onert::backend::cpu::ops::DynamicUpdateSliceLayer::run ( )
overridevirtual

Implements onert::exec::IFunction.

Definition at line 48 of file DynamicUpdateSlice.cc.

49{
50 // Get indices data as int64 type vector
51 std::vector<int64_t> indices_data(_indices->getShape().num_elements());
52 for (size_t i = 0; i < indices_data.size(); ++i)
53 {
54 if (_indices->data_type() == OperandType::INT32)
55 {
56 indices_data[i] = static_cast<int64_t>(getBuffer<int32_t>(_indices)[i]);
57 }
58 else
59 {
60 assert(_indices->data_type() == OperandType::INT64);
61 indices_data[i] = getBuffer<int64_t>(_indices)[i];
62 }
63 }
64
65 switch (_operand->data_type())
66 {
67 case OperandType::FLOAT32:
68 nnfw::cker::DynamicUpdateSlice()(getShape(_operand), getBuffer<float>(_operand),
69 getShape(_update), getBuffer<float>(_update), indices_data,
70 getBuffer<float>(_output));
71 break;
72 case OperandType::QUANT_UINT8_ASYMM:
73 nnfw::cker::DynamicUpdateSlice()(getShape(_operand), getBuffer<uint8_t>(_operand),
74 getShape(_update), getBuffer<uint8_t>(_update), indices_data,
75 getBuffer<uint8_t>(_output));
76 break;
77 case OperandType::QUANT_INT16_SYMM:
78 nnfw::cker::DynamicUpdateSlice()(getShape(_operand), getBuffer<int8_t>(_operand),
79 getShape(_update), getBuffer<int8_t>(_update), indices_data,
80 getBuffer<int8_t>(_output));
81 break;
82 default:
83 throw std::runtime_error{"DynamicUpdateSlice: NYI - unsupported data type"};
84 break;
85 }
86}
ir::DataType data_type() const override final
ir::Shape getShape() const override final
Get ir::Shape of tensor.
nnfw::cker::Shape getShape(const IPortableTensor *tensor)

References onert::backend::IPortableTensor::data_type(), onert::backend::IPortableTensor::getShape(), and onert::backend::cpu::ops::getShape().


The documentation for this class was generated from the following files: