ONE - On-device Neural Engine
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
luci_interpreter::kernels::CumSum Class Reference

#include <CumSum.h>

Collaboration diagram for luci_interpreter::kernels::CumSum:

Public Member Functions

 CumSum (const Tensor *input, const Tensor *axis, Tensor *output, const CumSumParams &params)
 
const Tensorinput () const
 
const Tensoraxis () const
 
Tensoroutput () const
 
void configure () override
 
void execute () const override
 
- Public Member Functions inherited from luci_interpreter::KernelWithParams< CumSumParams >
const CumSumParamsparams () 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< CumSumParams >
 KernelWithParams (std::vector< const Tensor * > inputs, std::vector< Tensor * > outputs, const CumSumParams &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< CumSumParams >
const CumSumParams _params
 
- Protected Attributes inherited from luci_interpreter::Kernel
const std::vector< const Tensor * > _inputs
 
const std::vector< Tensor * > _outputs
 

Detailed Description

Definition at line 30 of file CumSum.h.

Constructor & Destructor Documentation

◆ CumSum()

luci_interpreter::kernels::CumSum::CumSum ( const Tensor input,
const Tensor axis,
Tensor output,
const CumSumParams params 
)

Definition at line 28 of file CumSum.cpp.

29 : KernelWithParams<CumSumParams>({input, axis}, {output}, params)
30{
31}
const CumSumParams & params() const
Definition Kernel.h:67
const Tensor * axis() const
Definition CumSum.h:36
const Tensor * input() const
Definition CumSum.h:35

References axis(), and input().

Member Function Documentation

◆ axis()

const Tensor * luci_interpreter::kernels::CumSum::axis ( ) const
inline

Definition at line 36 of file CumSum.h.

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

References luci_interpreter::Kernel::_inputs.

Referenced by configure(), CumSum(), execute(), and metrics.categorical_accuracy.CategoricalAccuracy::update_state().

◆ configure()

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

Implements luci_interpreter::Kernel.

Definition at line 33 of file CumSum.cpp.

34{
35 LUCI_INTERPRETER_CHECK(input()->element_type() == output()->element_type());
36 LUCI_INTERPRETER_CHECK(input()->shape().num_dims() >= 1);
37
38 LUCI_INTERPRETER_CHECK(axis()->element_type() == DataType::S32);
39 LUCI_INTERPRETER_CHECK(axis()->shape().num_dims() == 0);
40
41 output()->resize(input()->shape());
42}
void resize(const Shape &new_shape)
Definition Tensor.cpp:56
#define LUCI_INTERPRETER_CHECK(cond)
Definition Utils.h:36

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

◆ execute()

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

Implements luci_interpreter::Kernel.

Definition at line 44 of file CumSum.cpp.

45{
46 switch (input()->element_type())
47 {
48 case DataType::FLOAT32:
49 tflite::optimized_ops::CumSum(getTensorData<float>(input()), getTensorShape(input()),
50 *getTensorData<int32_t>(axis()), params().exclusive,
51 params().reverse, getTensorData<float>(output()));
52 break;
53 case DataType::S32:
54 tflite::optimized_ops::CumSum(getTensorData<int32_t>(input()), getTensorShape(input()),
55 *getTensorData<int32_t>(axis()), params().exclusive,
56 params().reverse, getTensorData<int32_t>(output()));
57 break;
58 case DataType::S64:
59 tflite::optimized_ops::CumSum(getTensorData<int64_t>(input()), getTensorShape(input()),
60 *getTensorData<int32_t>(axis()), params().exclusive,
61 params().reverse, getTensorData<int64_t>(output()));
62 break;
63 default:
64 throw std::runtime_error("luci-intp CumSum Unsupported type.");
65 }
66}
tflite::RuntimeShape getTensorShape(const Tensor *tensor)
Definition Utils.h:194

References axis(), luci_interpreter::kernels::getTensorShape(), input(), output(), and luci_interpreter::KernelWithParams< CumSumParams >::params().

◆ input()

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

Definition at line 35 of file CumSum.h.

35{ return _inputs[0]; }

References luci_interpreter::Kernel::_inputs.

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

◆ output()

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

Definition at line 37 of file CumSum.h.

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