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

#include <Shape.h>

Collaboration diagram for luci_interpreter::kernels::ShapeKernel:

Public Member Functions

 ShapeKernel (const Tensor *input, Tensor *output, const ShapeParams &params)
 
const Tensorinput () const
 
Tensoroutput () const
 
void configure () override
 
void execute () const override
 
- Public Member Functions inherited from luci_interpreter::KernelWithParams< ShapeParams >
const ShapeParamsparams () const
 
- 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::KernelWithParams< ShapeParams >
 KernelWithParams (std::vector< const Tensor * > inputs, std::vector< Tensor * > outputs, const ShapeParams &params)
 
- Protected Member Functions inherited from luci_interpreter::Kernel
 Kernel (std::vector< const Tensor * > inputs, std::vector< Tensor * > outputs)
 
- Protected Attributes inherited from luci_interpreter::KernelWithParams< ShapeParams >
const ShapeParams _params
 
- 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 Shape.h.

Constructor & Destructor Documentation

◆ ShapeKernel()

luci_interpreter::kernels::ShapeKernel::ShapeKernel ( const Tensor input,
Tensor output,
const ShapeParams params 
)

Definition at line 25 of file Shape.cpp.

26 : KernelWithParams<ShapeParams>({input}, {output}, params)
27{
28}
const Tensor * input() const
Definition Shape.h:33

References input().

Member Function Documentation

◆ configure()

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

Implements luci_interpreter::Kernel.

Definition at line 30 of file Shape.cpp.

31{
32 LUCI_INTERPRETER_CHECK(output()->element_type() == DataType::S32 or
33 output()->element_type() == DataType::S64);
34 const auto input_shape = input()->shape();
35
37 output_shape.dim(0) = input_shape.num_dims();
38
40}
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 input(), LUCI_INTERPRETER_CHECK, output(), output_shape, luci_interpreter::Tensor::resize(), and luci_interpreter::Tensor::shape().

◆ execute()

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

Implements luci_interpreter::Kernel.

Definition at line 42 of file Shape.cpp.

43{
44 switch (params().out_type)
45 {
46 case DataType::S32:
47 evalInt<int32_t>();
48 break;
49 case DataType::S64:
50 evalInt<int64_t>();
51 break;
52 default:
53 throw std::runtime_error("luci-intp Shape Unsupported type.");
54 }
55}

References luci_interpreter::KernelWithParams< ShapeParams >::params().

◆ input()

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

Definition at line 33 of file Shape.h.

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

References luci_interpreter::Kernel::_inputs.

Referenced by configure(), and ShapeKernel().

◆ output()

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

Definition at line 34 of file Shape.h.

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

References luci_interpreter::Kernel::_outputs.

Referenced by configure().


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