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

#include <KernelBuilderHelper.h>

Public Member Functions

 KernelBuilderHelper (const std::unordered_map< const loco::Graph *, RuntimeGraph * > &graph_to_runtime_graph, const std::unordered_map< const loco::Node *, Tensor * > &node_to_tensor)
 
const TensorgetInputTensor (const loco::Node *node) const
 
const TensorgetOptionalInputTensor (const loco::Node *node) const
 
TensorgetOutputTensor (const loco::Node *node) const
 
std::vector< Tensor * > getOutputTensors (const std::vector< const loco::Node * > &nodes) const
 
RuntimeGraphgetRuntimeGraph (const loco::Graph *graph) const
 
const std::unordered_map< const loco::Graph *, RuntimeGraph * > & graph_to_runtime_graph () const
 
const std::unordered_map< const loco::Node *, Tensor * > & node_to_tensor () const
 

Detailed Description

Definition at line 32 of file KernelBuilderHelper.h.

Constructor & Destructor Documentation

◆ KernelBuilderHelper()

luci_interpreter::KernelBuilderHelper::KernelBuilderHelper ( const std::unordered_map< const loco::Graph *, RuntimeGraph * > &  graph_to_runtime_graph,
const std::unordered_map< const loco::Node *, Tensor * > &  node_to_tensor 
)
inline

Definition at line 35 of file KernelBuilderHelper.h.

38 : _graph_to_runtime_graph(graph_to_runtime_graph), _node_to_tensor(node_to_tensor)
39 {
40 }
const std::unordered_map< const loco::Graph *, RuntimeGraph * > & graph_to_runtime_graph() const
const std::unordered_map< const loco::Node *, Tensor * > & node_to_tensor() const

Member Function Documentation

◆ getInputTensor()

const Tensor * luci_interpreter::KernelBuilderHelper::getInputTensor ( const loco::Node node) const

Definition at line 24 of file KernelBuilderHelper.cpp.

25{
26 const Tensor *tensor = _node_to_tensor.at(node);
27 assert(tensor != nullptr);
28 return tensor;
29}

Referenced by luci_interpreter::build_kernel_CircleAbs(), luci_interpreter::build_kernel_CircleAdd(), luci_interpreter::build_kernel_CircleArgMax(), luci_interpreter::build_kernel_CircleAveragePool2D(), luci_interpreter::build_kernel_CircleBatchMatMul(), luci_interpreter::build_kernel_CircleBatchToSpaceND(), luci_interpreter::build_kernel_CircleBroadcastTo(), luci_interpreter::build_kernel_CircleCast(), luci_interpreter::build_kernel_CircleConcatenation(), luci_interpreter::build_kernel_CircleConv2D(), luci_interpreter::build_kernel_CircleCos(), luci_interpreter::build_kernel_CircleCumSum(), luci_interpreter::build_kernel_CircleDepthToSpace(), luci_interpreter::build_kernel_CircleDepthwiseConv2D(), luci_interpreter::build_kernel_CircleDequantize(), luci_interpreter::build_kernel_CircleDiv(), luci_interpreter::build_kernel_CircleElu(), luci_interpreter::build_kernel_CircleEqual(), luci_interpreter::build_kernel_CircleExp(), luci_interpreter::build_kernel_CircleExpandDims(), luci_interpreter::build_kernel_CircleFill(), luci_interpreter::build_kernel_CircleFloor(), luci_interpreter::build_kernel_CircleFloorDiv(), luci_interpreter::build_kernel_CircleFloorMod(), luci_interpreter::build_kernel_CircleFullyConnected(), luci_interpreter::build_kernel_CircleGather(), luci_interpreter::build_kernel_CircleGelu(), luci_interpreter::build_kernel_CircleGreater(), luci_interpreter::build_kernel_CircleGreaterEqual(), luci_interpreter::build_kernel_CircleGRU(), luci_interpreter::build_kernel_CircleHardSwish(), luci_interpreter::build_kernel_CircleIf(), luci_interpreter::build_kernel_CircleInstanceNorm(), luci_interpreter::build_kernel_CircleL2Normalize(), luci_interpreter::build_kernel_CircleL2Pool2D(), luci_interpreter::build_kernel_CircleLeakyRelu(), luci_interpreter::build_kernel_CircleLess(), luci_interpreter::build_kernel_CircleLessEqual(), luci_interpreter::build_kernel_CircleLocalResponseNormalization(), luci_interpreter::build_kernel_CircleLog(), luci_interpreter::build_kernel_CircleLogicalAnd(), luci_interpreter::build_kernel_CircleLogicalNot(), luci_interpreter::build_kernel_CircleLogicalOr(), luci_interpreter::build_kernel_CircleLogistic(), luci_interpreter::build_kernel_CircleLogSoftmax(), luci_interpreter::build_kernel_CircleMaximum(), luci_interpreter::build_kernel_CircleMaxPool2D(), luci_interpreter::build_kernel_CircleMean(), luci_interpreter::build_kernel_CircleMinimum(), luci_interpreter::build_kernel_CircleMirrorPad(), luci_interpreter::build_kernel_CircleMul(), luci_interpreter::build_kernel_CircleNeg(), luci_interpreter::build_kernel_CircleNotEqual(), luci_interpreter::build_kernel_CircleOneHot(), luci_interpreter::build_kernel_CirclePack(), luci_interpreter::build_kernel_CirclePad(), luci_interpreter::build_kernel_CirclePadV2(), luci_interpreter::build_kernel_CirclePow(), luci_interpreter::build_kernel_CirclePRelu(), luci_interpreter::build_kernel_CircleQuantize(), luci_interpreter::build_kernel_CircleReduceMax(), luci_interpreter::build_kernel_CircleReduceProd(), luci_interpreter::build_kernel_CircleRelu(), luci_interpreter::build_kernel_CircleRelu0To1(), luci_interpreter::build_kernel_CircleRelu6(), luci_interpreter::build_kernel_CircleReshape(), luci_interpreter::build_kernel_CircleResizeBilinear(), luci_interpreter::build_kernel_CircleResizeNearestNeighbor(), luci_interpreter::build_kernel_CircleReverseV2(), luci_interpreter::build_kernel_CircleRmsNorm(), luci_interpreter::build_kernel_CircleRoPE(), luci_interpreter::build_kernel_CircleRsqrt(), luci_interpreter::build_kernel_CircleSelect(), luci_interpreter::build_kernel_CircleSelectV2(), luci_interpreter::build_kernel_CircleShape(), luci_interpreter::build_kernel_CircleSin(), luci_interpreter::build_kernel_CircleSlice(), luci_interpreter::build_kernel_CircleSoftmax(), luci_interpreter::build_kernel_CircleSpaceToBatchND(), luci_interpreter::build_kernel_CircleSpaceToDepth(), luci_interpreter::build_kernel_CircleSplit(), luci_interpreter::build_kernel_CircleSplitV(), luci_interpreter::build_kernel_CircleSqrt(), luci_interpreter::build_kernel_CircleSquare(), luci_interpreter::build_kernel_CircleSquaredDifference(), luci_interpreter::build_kernel_CircleSqueeze(), luci_interpreter::build_kernel_CircleStridedSlice(), luci_interpreter::build_kernel_CircleSub(), luci_interpreter::build_kernel_CircleSum(), luci_interpreter::build_kernel_CircleSVDF(), luci_interpreter::build_kernel_CircleTanh(), luci_interpreter::build_kernel_CircleTile(), luci_interpreter::build_kernel_CircleTranspose(), luci_interpreter::build_kernel_CircleTransposeConv(), luci_interpreter::build_kernel_CircleUnidirectionalSequenceLSTM(), luci_interpreter::build_kernel_CircleUnpack(), luci_interpreter::build_kernel_CircleWhile(), and getOptionalInputTensor().

◆ getOptionalInputTensor()

const Tensor * luci_interpreter::KernelBuilderHelper::getOptionalInputTensor ( const loco::Node node) const

Definition at line 31 of file KernelBuilderHelper.cpp.

32{
33 if (dynamic_cast<const luci::CircleOutputExclude *>(node))
34 {
35 return nullptr;
36 }
37 return getInputTensor(node);
38}
CircleOutputExclude is used to specifying not exported nodes.
const Tensor * getInputTensor(const loco::Node *node) const

References getInputTensor().

Referenced by luci_interpreter::build_kernel_CircleConv2D(), luci_interpreter::build_kernel_CircleFullyConnected(), luci_interpreter::build_kernel_CircleSVDF(), luci_interpreter::build_kernel_CircleTransposeConv(), and luci_interpreter::build_kernel_CircleUnidirectionalSequenceLSTM().

◆ getOutputTensor()

Tensor * luci_interpreter::KernelBuilderHelper::getOutputTensor ( const loco::Node node) const

Definition at line 40 of file KernelBuilderHelper.cpp.

41{
42 Tensor *tensor = _node_to_tensor.at(node);
43 assert(tensor != nullptr);
44 return tensor;
45}

Referenced by luci_interpreter::build_kernel_CircleAbs(), luci_interpreter::build_kernel_CircleAdd(), luci_interpreter::build_kernel_CircleArgMax(), luci_interpreter::build_kernel_CircleAveragePool2D(), luci_interpreter::build_kernel_CircleBatchMatMul(), luci_interpreter::build_kernel_CircleBatchToSpaceND(), luci_interpreter::build_kernel_CircleBroadcastTo(), luci_interpreter::build_kernel_CircleCast(), luci_interpreter::build_kernel_CircleConcatenation(), luci_interpreter::build_kernel_CircleConv2D(), luci_interpreter::build_kernel_CircleCos(), luci_interpreter::build_kernel_CircleCumSum(), luci_interpreter::build_kernel_CircleDepthToSpace(), luci_interpreter::build_kernel_CircleDepthwiseConv2D(), luci_interpreter::build_kernel_CircleDequantize(), luci_interpreter::build_kernel_CircleDiv(), luci_interpreter::build_kernel_CircleElu(), luci_interpreter::build_kernel_CircleEqual(), luci_interpreter::build_kernel_CircleExp(), luci_interpreter::build_kernel_CircleExpandDims(), luci_interpreter::build_kernel_CircleFill(), luci_interpreter::build_kernel_CircleFloor(), luci_interpreter::build_kernel_CircleFloorDiv(), luci_interpreter::build_kernel_CircleFloorMod(), luci_interpreter::build_kernel_CircleFullyConnected(), luci_interpreter::build_kernel_CircleGather(), luci_interpreter::build_kernel_CircleGelu(), luci_interpreter::build_kernel_CircleGreater(), luci_interpreter::build_kernel_CircleGreaterEqual(), luci_interpreter::build_kernel_CircleGRU(), luci_interpreter::build_kernel_CircleHardSwish(), luci_interpreter::build_kernel_CircleInstanceNorm(), luci_interpreter::build_kernel_CircleL2Normalize(), luci_interpreter::build_kernel_CircleL2Pool2D(), luci_interpreter::build_kernel_CircleLeakyRelu(), luci_interpreter::build_kernel_CircleLess(), luci_interpreter::build_kernel_CircleLessEqual(), luci_interpreter::build_kernel_CircleLocalResponseNormalization(), luci_interpreter::build_kernel_CircleLog(), luci_interpreter::build_kernel_CircleLogicalAnd(), luci_interpreter::build_kernel_CircleLogicalNot(), luci_interpreter::build_kernel_CircleLogicalOr(), luci_interpreter::build_kernel_CircleLogistic(), luci_interpreter::build_kernel_CircleLogSoftmax(), luci_interpreter::build_kernel_CircleMaximum(), luci_interpreter::build_kernel_CircleMaxPool2D(), luci_interpreter::build_kernel_CircleMean(), luci_interpreter::build_kernel_CircleMinimum(), luci_interpreter::build_kernel_CircleMirrorPad(), luci_interpreter::build_kernel_CircleMul(), luci_interpreter::build_kernel_CircleNeg(), luci_interpreter::build_kernel_CircleNotEqual(), luci_interpreter::build_kernel_CircleOneHot(), luci_interpreter::build_kernel_CirclePack(), luci_interpreter::build_kernel_CirclePad(), luci_interpreter::build_kernel_CirclePadV2(), luci_interpreter::build_kernel_CirclePow(), luci_interpreter::build_kernel_CirclePRelu(), luci_interpreter::build_kernel_CircleQuantize(), luci_interpreter::build_kernel_CircleReduceMax(), luci_interpreter::build_kernel_CircleReduceProd(), luci_interpreter::build_kernel_CircleRelu(), luci_interpreter::build_kernel_CircleRelu0To1(), luci_interpreter::build_kernel_CircleRelu6(), luci_interpreter::build_kernel_CircleReshape(), luci_interpreter::build_kernel_CircleResizeBilinear(), luci_interpreter::build_kernel_CircleResizeNearestNeighbor(), luci_interpreter::build_kernel_CircleReverseV2(), luci_interpreter::build_kernel_CircleRmsNorm(), luci_interpreter::build_kernel_CircleRoPE(), luci_interpreter::build_kernel_CircleRsqrt(), luci_interpreter::build_kernel_CircleSelect(), luci_interpreter::build_kernel_CircleSelectV2(), luci_interpreter::build_kernel_CircleShape(), luci_interpreter::build_kernel_CircleSin(), luci_interpreter::build_kernel_CircleSlice(), luci_interpreter::build_kernel_CircleSoftmax(), luci_interpreter::build_kernel_CircleSpaceToBatchND(), luci_interpreter::build_kernel_CircleSpaceToDepth(), luci_interpreter::build_kernel_CircleSqrt(), luci_interpreter::build_kernel_CircleSquare(), luci_interpreter::build_kernel_CircleSquaredDifference(), luci_interpreter::build_kernel_CircleSqueeze(), luci_interpreter::build_kernel_CircleStridedSlice(), luci_interpreter::build_kernel_CircleSub(), luci_interpreter::build_kernel_CircleSum(), luci_interpreter::build_kernel_CircleSVDF(), luci_interpreter::build_kernel_CircleTanh(), luci_interpreter::build_kernel_CircleTile(), luci_interpreter::build_kernel_CircleTranspose(), luci_interpreter::build_kernel_CircleTransposeConv(), luci_interpreter::build_kernel_CircleUnidirectionalSequenceLSTM(), and getOutputTensors().

◆ getOutputTensors()

std::vector< Tensor * > luci_interpreter::KernelBuilderHelper::getOutputTensors ( const std::vector< const loco::Node * > &  nodes) const

Definition at line 48 of file KernelBuilderHelper.cpp.

49{
50 std::vector<Tensor *> tensors;
51 tensors.reserve(nodes.size());
52 for (const loco::Node *node : nodes)
53 tensors.push_back(getOutputTensor(node));
54 return tensors;
55}
Logical unit of computation.
Definition Node.h:54
Tensor * getOutputTensor(const loco::Node *node) const

References getOutputTensor().

Referenced by luci_interpreter::build_kernel_CircleIf(), luci_interpreter::build_kernel_CircleSplit(), luci_interpreter::build_kernel_CircleSplitV(), luci_interpreter::build_kernel_CircleUnpack(), and luci_interpreter::build_kernel_CircleWhile().

◆ getRuntimeGraph()

◆ graph_to_runtime_graph()

const std::unordered_map< const loco::Graph *, RuntimeGraph * > & luci_interpreter::KernelBuilderHelper::graph_to_runtime_graph ( ) const
inline

Definition at line 52 of file KernelBuilderHelper.h.

53 {
54 return _graph_to_runtime_graph;
55 }

◆ node_to_tensor()

const std::unordered_map< const loco::Node *, Tensor * > & luci_interpreter::KernelBuilderHelper::node_to_tensor ( ) const
inline

Definition at line 57 of file KernelBuilderHelper.h.

58 {
59 return _node_to_tensor;
60 }

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