ONE - On-device Neural Engine
Loading...
Searching...
No Matches
luci_interpreter::kernels::Reshape Class Reference

#include <Reshape.h>

Collaboration diagram for luci_interpreter::kernels::Reshape:

Public Member Functions

 Reshape (const Tensor *input, const Tensor *shape, Tensor *output)
 
const Tensorinput () const
 
const Tensorshape () const
 
Tensoroutput () const
 
void configure () override
 
void execute () const override
 
- Public Member Functions inherited from luci_interpreter::Kernel
virtual ~Kernel ()=default
 
const std::vector< const Tensor * > & getInputTensors () const
 
const std::vector< Tensor * > & getOutputTensors () const
 

Additional Inherited Members

- Protected Member Functions inherited from luci_interpreter::Kernel
 Kernel (std::vector< const Tensor * > inputs, std::vector< Tensor * > outputs)
 
- Protected Attributes inherited from luci_interpreter::Kernel
const std::vector< const Tensor * > _inputs
 
const std::vector< Tensor * > _outputs
 

Detailed Description

Definition at line 27 of file Reshape.h.

Constructor & Destructor Documentation

◆ Reshape()

luci_interpreter::kernels::Reshape::Reshape ( const Tensor input,
const Tensor shape,
Tensor output 
)

Definition at line 84 of file Reshape.cpp.

85 : Kernel({input, shape}, {output})
86{
87}
Kernel(std::vector< const Tensor * > inputs, std::vector< Tensor * > outputs)
Definition Kernel.h:31
const Tensor * shape() const
Definition Reshape.h:33
const Tensor * input() const
Definition Reshape.h:32

References input(), and shape().

Member Function Documentation

◆ configure()

void luci_interpreter::kernels::Reshape::configure ( )
overridevirtual

Implements luci_interpreter::Kernel.

Definition at line 89 of file Reshape.cpp.

90{
91 Shape output_shape = extractShapeFromTensor(shape());
92 resolveUnknownDimension(input()->shape(), &output_shape);
94}
void resize(const Shape &new_shape)
Definition Tensor.cpp:56
const luci_interpreter::RuntimeShape output_shape
Definition Shape.h:28

References input(), output(), output_shape, luci_interpreter::Tensor::resize(), and shape().

◆ execute()

void luci_interpreter::kernels::Reshape::execute ( ) const
overridevirtual

Implements luci_interpreter::Kernel.

Definition at line 96 of file Reshape.cpp.

97{
98 const auto *input_data = input()->data<void>();
99 auto *output_data = output()->data<void>();
100
101 const size_t element_size = getDataTypeSize(input()->element_type());
102 const int32_t num_elements = input()->shape().num_elements();
103 std::memcpy(output_data, input_data, num_elements * element_size);
104}
int32_t num_elements() const
Definition Tensor.h:53
const Shape & shape() const
Definition Tensor.h:107
const T * data() const
Definition Tensor.h:127
list input_data
Definition infer.py:29
size_t getDataTypeSize(DataType data_type)
Definition DataType.h:33
uint32_t num_elements(const Shape &shape)
The number of elements of a feature map of a given shape.
Definition Shape.h:59

References luci_interpreter::Tensor::data(), luci_interpreter::getDataTypeSize(), input(), luci_interpreter::Shape::num_elements(), output(), and luci_interpreter::Tensor::shape().

◆ input()

const Tensor * luci_interpreter::kernels::Reshape::input ( ) const
inline

Definition at line 32 of file Reshape.h.

32{ return _inputs[0]; }
const std::vector< const Tensor * > _inputs
Definition Kernel.h:52

References luci_interpreter::Kernel::_inputs.

Referenced by configure(), execute(), and Reshape().

◆ output()

Tensor * luci_interpreter::kernels::Reshape::output ( ) const
inline

Definition at line 34 of file Reshape.h.

34{ return _outputs[0]; }
const std::vector< Tensor * > _outputs
Definition Kernel.h:53

References luci_interpreter::Kernel::_outputs.

Referenced by configure(), and execute().

◆ shape()


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