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

#include <Tile.h>

Collaboration diagram for luci_interpreter::kernels::Tile:

Public Member Functions

 Tile (const Tensor *input, const Tensor *multiplies, Tensor *output)
 
const Tensorinput () const
 
const Tensormultiples () 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 Tile.h.

Constructor & Destructor Documentation

◆ Tile()

luci_interpreter::kernels::Tile::Tile ( const Tensor input,
const Tensor multiplies,
Tensor output 
)

Definition at line 27 of file Tile.cpp.

29{
30}
Kernel(std::vector< const Tensor * > inputs, std::vector< Tensor * > outputs)
Definition Kernel.h:31
const Tensor * multiples() const
Definition Tile.h:34
Tensor * output() const
Definition Tile.h:35
const Tensor * input() const
Definition Tile.h:33

References input(), and multiples().

Member Function Documentation

◆ configure()

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

Implements luci_interpreter::Kernel.

Definition at line 32 of file Tile.cpp.

33{
34 LUCI_INTERPRETER_CHECK(input()->shape().num_dims() >= 1);
35 LUCI_INTERPRETER_CHECK(multiples()->shape().num_dims() == 1);
36 LUCI_INTERPRETER_CHECK(multiples()->shape().dim(0) == input()->shape().num_dims());
37 LUCI_INTERPRETER_CHECK(multiples()->element_type() == DataType::S32);
38
39 Shape output_shape(input()->shape().num_dims());
40 const int32_t *muldata = getTensorData<int32_t>(multiples());
41 int32_t num_dim = multiples()->shape().dim(0);
42 for (int32_t dim = 0; dim < num_dim; ++dim)
43 {
44 output_shape.dim(dim) = input()->shape().dim(dim) * muldata[dim];
45 }
47}
int32_t dim(int i) const
Definition Tensor.h:41
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
const luci_interpreter::RuntimeShape output_shape
Definition Shape.h:28

References luci_interpreter::Shape::dim(), input(), LUCI_INTERPRETER_CHECK, multiples(), output(), output_shape, luci_interpreter::Tensor::resize(), and luci_interpreter::Tensor::shape().

◆ execute()

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

Implements luci_interpreter::Kernel.

Definition at line 49 of file Tile.cpp.

50{
51 switch (output()->element_type())
52 {
53 case DataType::FLOAT32:
54 evalFloat();
55 break;
56 default:
57 throw std::runtime_error("luci-intp Tile Unsupported type.");
58 }
59}

References output().

◆ input()

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

Definition at line 33 of file Tile.h.

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

References luci_interpreter::Kernel::_inputs.

Referenced by configure(), and Tile().

◆ multiples()

const Tensor * luci_interpreter::kernels::Tile::multiples ( ) const
inline

Definition at line 34 of file Tile.h.

34{ return _inputs[1]; }

References luci_interpreter::Kernel::_inputs.

Referenced by configure(), and Tile().

◆ output()

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

Definition at line 35 of file Tile.h.

35{ 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: