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

#include <Cast.h>

Collaboration diagram for luci_interpreter::kernels::Cast:

Public Member Functions

 Cast (const Tensor *input, Tensor *output)
 
const Tensorinput () 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 28 of file Cast.h.

Constructor & Destructor Documentation

◆ Cast()

luci_interpreter::kernels::Cast::Cast ( const Tensor input,
Tensor output 
)

Definition at line 124 of file Cast.cpp.

124: Kernel({input}, {output}) {}
Tensor * output() const
Definition Cast.h:34
const Tensor * input() const
Definition Cast.h:33

References input().

Member Function Documentation

◆ configure()

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

Implements luci_interpreter::Kernel.

Definition at line 126 of file Cast.cpp.

127{
128 LUCI_INTERPRETER_CHECK(input()->element_type() != loco::DataType::Unknown);
129 LUCI_INTERPRETER_CHECK(output()->element_type() != loco::DataType::Unknown);
130
131 const Shape &shape = input()->shape();
132 output()->resize(shape);
133}
void resize(const Shape &new_shape)
Definition Tensor.cpp:56
const Shape & shape() const
Definition Tensor.h:107
#define LUCI_INTERPRETER_CHECK(cond)
Definition Utils.h:36
Definition Shape.h:28

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

◆ execute()

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

Implements luci_interpreter::Kernel.

Definition at line 135 of file Cast.cpp.

136{
137 assert(input()->shape().num_elements() == output()->shape().num_elements());
138
139 cast_from_tensor_to_tensor(input(), output());
140}
uint32_t num_elements(const Shape &shape)
The number of elements of a feature map of a given shape.
Definition Shape.h:59

References input(), and output().

◆ input()

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

Definition at line 33 of file Cast.h.

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

References luci_interpreter::Kernel::_inputs.

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

◆ output()

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

Definition at line 34 of file Cast.h.

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

References luci_interpreter::Kernel::_outputs.

Referenced by configure(), and execute().


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