ONE - On-device Neural Engine
Loading...
Searching...
No Matches
nnfw::cker::multithreaded Namespace Reference

Functions

void Conv (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)
 

Function Documentation

◆ Conv()

void nnfw::cker::multithreaded::Conv ( 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 
)
inline

Definition at line 254 of file Conv.h.

257{
258 const Eigen::ThreadPoolDevice &device = *eigen_support::GetThreadPoolDevice();
259
260 const int stride_width = params.stride_width;
261 const int stride_height = params.stride_height;
262 const PaddingType padding = params.padding_type;
263 const int pad_width = params.padding_values.width;
264 const int pad_height = params.padding_values.height;
265 const float output_activation_min = params.float_activation_min;
266 const float output_activation_max = params.float_activation_max;
267 assert(input_shape.DimensionsCount() == 4);
268 assert(filter_shape.DimensionsCount() == 4);
269 assert(output_shape.DimensionsCount() == 4);
270
271 const int batches = MatchingDim(input_shape, 0, output_shape, 0);
272 const int input_depth = MatchingDim(input_shape, 3, filter_shape, 3);
273 const int output_depth = MatchingDim(filter_shape, 0, output_shape, 3);
274 const int input_height = input_shape.Dims(1);
275 const int input_width = input_shape.Dims(2);
276 const int filter_height = filter_shape.Dims(1);
277 const int filter_width = filter_shape.Dims(2);
278 const int output_height = output_shape.Dims(1);
279 const int output_width = output_shape.Dims(2);
280
281 EigenTensorConvFunctor<float> conv_functor;
282 conv_functor(device, input_data, batches, input_height, input_width, input_depth, filter_data,
283 filter_height, filter_width, output_depth, stride_height, stride_width, pad_height,
284 pad_width, padding, output_data, output_height, output_width);
285
286 optimized::AddBiasAndEvalActivationFunction(output_activation_min, output_activation_max,
287 bias_shape, bias_data, output_shape, output_data);
288}
int32_t DimensionsCount() const
Definition Shape.h:91
int32_t Dims(int i) const
Definition Shape.h:92
const luci_interpreter::RuntimeShape output_shape
int MatchingDim(const Shape &shape1, int index1, const Shape &shape2, int index2)
Definition Shape.h:220
PaddingType
Definition Types.h:41
int16_t stride_height
Definition Types.h:146
PaddingValues padding_values
Definition Types.h:143
float float_activation_max
Definition Types.h:161
float float_activation_min
Definition Types.h:160
PaddingType padding_type
Definition Types.h:142

References nnfw::cker::optimized::AddBiasAndEvalActivationFunction(), nnfw::cker::Shape::DimensionsCount(), nnfw::cker::Shape::Dims(), nnfw::cker::ConvParams::float_activation_max, nnfw::cker::ConvParams::float_activation_min, nnfw::cker::eigen_support::GetThreadPoolDevice(), nnfw::cker::PaddingValues::height, nnfw::cker::MatchingDim(), output_shape, nnfw::cker::ConvParams::padding_type, nnfw::cker::ConvParams::padding_values, nnfw::cker::ConvParams::stride_height, nnfw::cker::ConvParams::stride_width, and nnfw::cker::PaddingValues::width.

Referenced by nnfw::cker::Conv::operator()().