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

#include <ReverseLayer.h>

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

Public Member Functions

 ReverseLayer ()
 
void configure (const IPortableTensor *input, const IPortableTensor *axis, IPortableTensor *output)
 
void run () override
 
- Public Member Functions inherited from onert::exec::IFunction
virtual ~IFunction ()=default
 
virtual void prepare ()
 

Detailed Description

Definition at line 33 of file ReverseLayer.h.

Constructor & Destructor Documentation

◆ ReverseLayer()

onert::backend::cpu::ops::ReverseLayer::ReverseLayer ( )
inline

Definition at line 36 of file ReverseLayer.h.

36 : _input{nullptr}, _axis{nullptr}, _output{nullptr}
37 {
38 // DO NOTHING
39 }

Member Function Documentation

◆ configure()

void onert::backend::cpu::ops::ReverseLayer::configure ( const IPortableTensor input,
const IPortableTensor axis,
IPortableTensor output 
)

Definition at line 56 of file ReverseLayer.cc.

58{
59 _input = input;
60 _axis = axis;
61 _output = output;
62}

◆ run()

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

Implements onert::exec::IFunction.

Definition at line 32 of file ReverseLayer.cc.

33{
34
35 if (_axis->total_size() != 4)
36 {
37 throw std::runtime_error{"Reverse: only support 1 axis"};
38 }
39 int32_t axis = *getBuffer<int32_t>(_axis);
40 if (axis < 0)
41 {
42 axis += _input->getShape().rank();
43 }
44
45 switch (_input->data_type())
46 {
47 case OperandType::FLOAT32:
48 nnfw::cker::Reverse<float>(axis, getShape(_input), getBuffer<float>(_input),
49 getShape(_output), getBuffer<float>(_output));
50 break;
51 default:
52 throw std::runtime_error{"Reverse: unsupported data type"};
53 }
54}
size_t total_size() const override final
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(), onert::backend::cpu::ops::getShape(), and onert::backend::IPortableTensor::total_size().

Referenced by package.infer.session::inference().


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