ONE - On-device Neural Engine
Loading...
Searching...
No Matches
nnfw::ruy::Conv Class Reference

#include <Conv.h>

Public Member Functions

 Conv ()
 
void prepare (const Shape &input_shape, const Shape &kernel_shape, const Shape &output_shape, uint32_t stride_width, uint32_t stride_height, uint32_t dilation_width_factor, uint32_t dilation_height_factor)
 
void operator() (const ConvParams &params, const Shape &input_shape, const float *input_data, const Shape &filter_shape, const float *filter_data, const Shape &bias_shape, const float *bias_data, const Shape &output_shape, float *output_data, ::ruy::Context *ruy_context)
 

Detailed Description

Definition at line 36 of file Conv.h.

Constructor & Destructor Documentation

◆ Conv()

nnfw::ruy::Conv::Conv ( )
inline

Definition at line 39 of file Conv.h.

39: _im2col_shape(4), _need_im2col(false), _prepared(false) {}

Member Function Documentation

◆ operator()()

void nnfw::ruy::Conv::operator() ( const ConvParams params,
const Shape input_shape,
const float *  input_data,
const Shape filter_shape,
const float *  filter_data,
const Shape bias_shape,
const float *  bias_data,
const Shape output_shape,
float *  output_data,
::ruy::Context *  ruy_context 
)
inline

Definition at line 53 of file Conv.h.

57 {
58 if (!_prepared)
59 {
60 // This means that input or output are dynamic or filter is not constant
61 IsRequiredIm2col(input_shape, filter_shape, output_shape, params.stride_width,
62 params.stride_height, params.dilation_width_factor,
63 params.dilation_height_factor);
64 _prepared = true;
65 }
66
67 int im2col_size = _need_im2col ? _im2col_shape.FlatSize() : 0;
68 std::vector<float> im2col_data(im2col_size);
69 if (im2col_size > 0)
70 {
71 ConvFloat(params, input_shape, input_data, filter_shape, filter_data, bias_shape, bias_data,
72 output_shape, output_data, _im2col_shape, im2col_data.data(), ruy_context);
73 }
74 else
75 {
76 ConvFloat(params, input_shape, input_data, filter_shape, filter_data, bias_shape, bias_data,
77 output_shape, output_data, _im2col_shape, nullptr, ruy_context);
78 }
79 }
int FlatSize() const
Definition Shape.h:181
const luci_interpreter::RuntimeShape output_shape

References nnfw::ruy::ConvParams::dilation_height_factor, nnfw::ruy::ConvParams::dilation_width_factor, nnfw::ruy::Shape::FlatSize(), output_shape, nnfw::ruy::ConvParams::stride_height, and nnfw::ruy::ConvParams::stride_width.

◆ prepare()

void nnfw::ruy::Conv::prepare ( const Shape input_shape,
const Shape kernel_shape,
const Shape output_shape,
uint32_t  stride_width,
uint32_t  stride_height,
uint32_t  dilation_width_factor,
uint32_t  dilation_height_factor 
)
inline

Definition at line 41 of file Conv.h.

44 {
45 if (!_prepared)
46 {
47 IsRequiredIm2col(input_shape, kernel_shape, output_shape, stride_width, stride_height,
48 dilation_width_factor, dilation_height_factor);
49 _prepared = true;
50 }
51 }

References output_shape.

Referenced by onert::backend::ruy::ops::ConvolutionLayer::prepare().


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