ONE - On-device Neural Engine
Loading...
Searching...
No Matches
circle_planner::ScratchpadHelperMCU Class Reference

#include <ScratchpadHelperMCU.h>

Collaboration diagram for circle_planner::ScratchpadHelperMCU:

Public Member Functions

uint32_t ComputeScratchpadSizeAveragePool2d (const luci::CircleAveragePool2D *avg_pool) final
 
std::vector< uint32_t > ComputeScratchpadSizeBatchMatMul (const luci::CircleBatchMatMul *batch_mat_mul) final
 
uint32_t ComputeScratchpadSizeConv2d (const luci::CircleConv2D *) final
 
uint32_t ComputeScratchpadSizeDepthwiseConv2d (const luci::CircleDepthwiseConv2D *depthwise_conv) final
 
std::vector< uint32_t > ComputeScratchpadSizeSVDF (const luci::CircleSVDF *svdf) final
 
- Public Member Functions inherited from circle_planner::IScratchpadHelper
virtual ~IScratchpadHelper ()=default
 

Detailed Description

Definition at line 25 of file ScratchpadHelperMCU.h.

Member Function Documentation

◆ ComputeScratchpadSizeAveragePool2d()

uint32_t circle_planner::ScratchpadHelperMCU::ComputeScratchpadSizeAveragePool2d ( const luci::CircleAveragePool2D avg_pool)
inlinefinalvirtual

Implements circle_planner::IScratchpadHelper.

Definition at line 28 of file ScratchpadHelperMCU.h.

29 {
30 // for mcu AveragePool2d scratchpad tensors size = 0
31 return 0;
32 }

◆ ComputeScratchpadSizeBatchMatMul()

std::vector< uint32_t > circle_planner::ScratchpadHelperMCU::ComputeScratchpadSizeBatchMatMul ( const luci::CircleBatchMatMul batch_mat_mul)
inlinefinalvirtual

Implements circle_planner::IScratchpadHelper.

Definition at line 35 of file ScratchpadHelperMCU.h.

36 {
37 throw std::runtime_error("BatchMatMul is not currently supported for mcu platform");
38 }

◆ ComputeScratchpadSizeConv2d()

uint32_t circle_planner::ScratchpadHelperMCU::ComputeScratchpadSizeConv2d ( const luci::CircleConv2D )
inlinefinalvirtual

Implements circle_planner::IScratchpadHelper.

Definition at line 40 of file ScratchpadHelperMCU.h.

41 {
42 // for mcu scratchpad size = 0
43 return 0;
44 }

◆ ComputeScratchpadSizeDepthwiseConv2d()

uint32_t circle_planner::ScratchpadHelperMCU::ComputeScratchpadSizeDepthwiseConv2d ( const luci::CircleDepthwiseConv2D depthwise_conv)
inlinefinalvirtual

Implements circle_planner::IScratchpadHelper.

Definition at line 47 of file ScratchpadHelperMCU.h.

48 {
49 // for mcu DepthwiseConv2d scratchpad tensors size = 0
50 return 0;
51 }

◆ ComputeScratchpadSizeSVDF()

std::vector< uint32_t > circle_planner::ScratchpadHelperMCU::ComputeScratchpadSizeSVDF ( const luci::CircleSVDF svdf)
inlinefinalvirtual

Implements circle_planner::IScratchpadHelper.

Definition at line 53 of file ScratchpadHelperMCU.h.

54 {
55 const auto svdf_input = loco::must_cast<luci::CircleNode *>(svdf->input());
56 const auto weight_feature_input = loco::must_cast<luci::CircleNode *>(svdf->weight_feature());
57
58 if (svdf_input->dtype() == loco::DataType::FLOAT32 and
59 (weight_feature_input->dtype() == loco::DataType::S8 or
60 weight_feature_input->dtype() == loco::DataType::U8))
61 {
62 throw std::runtime_error("Hybrid type is not currently supported for linux platform");
63 }
64
65 std::vector<uint32_t> scratchpad_sizes;
66
67 const auto batch_size = svdf_input->dim(0).value();
68 const auto num_filters = weight_feature_input->dim(0).value();
69 const auto rank = svdf->svdf_rank();
70 const auto num_units = num_filters / rank;
71
72 if (svdf_input->dtype() == loco::DataType::S8)
73 {
74 scratchpad_sizes.push_back(batch_size * num_filters * sizeof(int32_t));
75 scratchpad_sizes.push_back(batch_size * num_units * sizeof(int32_t));
76 }
77 else
78 {
79 scratchpad_sizes.push_back(batch_size * num_filters * sizeof(float));
80 }
81
82 return scratchpad_sizes;
83 }
loco::Node * input(void) const
Definition CircleSVDF.h:38
loco::Node * weight_feature(void) const
Definition CircleSVDF.h:41
int32_t svdf_rank() const
Definition CircleSVDF.h:60

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