31 namespace interleaves {
34 unsigned int kernel_rows,
unsigned int kernel_cols,
size_t weight_element_size,
35 bool include_bias,
size_t bias_element_size,
bool premultiply,
36 arm_gemm::VLType vl_type,
size_t accumulator_element_size,
unsigned int accumulator_depth_vl,
37 std::function<
bool(
unsigned int,
unsigned int &,
unsigned int &)> get_weight_pos
38 ) : kernel_rows(kernel_rows), kernel_cols(kernel_cols), weight_element_size(weight_element_size),
39 include_bias(include_bias), bias_element_size(bias_element_size), premultiply(premultiply),
40 vl_type(vl_type), accumulator_element_size(accumulator_element_size), accumulator_depth_vl(accumulator_depth_vl),
41 get_weight_pos(get_weight_pos)
51 DepthwiseArgs args_per_input_channel(
args);
52 args_per_input_channel.input_channels =
args.channel_multiplier;
53 args_per_input_channel.channel_multiplier = 1;
58 const unsigned int vl =
64 return n_packs * pack_size * vl;
69 const DepthwiseArgs &
args,
71 const void *biases_raw,
72 const void *weights_raw,
78 auto *buffer =
static_cast<uint8_t *
>(buffer_raw);
79 auto *biases =
static_cast<const uint8_t *
>(biases_raw);
80 auto *weights =
static_cast<const uint8_t *
>(weights_raw);
87 DepthwiseArgs args_per_input_channel(
args);
88 args_per_input_channel.input_channels =
args.channel_multiplier;
89 args_per_input_channel.channel_multiplier = 1;
92 ld_weight_col = ld_weight_col ? ld_weight_col :
args.input_channels *
args.channel_multiplier;
93 ld_weight_row = ld_weight_row ? ld_weight_row : ld_weight_col * packing_args.
kernel_cols;
97 for (
unsigned int c = 0; c <
args.input_channels; c++)
100 packing_args, args_per_input_channel, buffer, biases, weights, ld_weight_col, ld_weight_row);
103 buffer += per_input_channel_size;
110 auto input_channels =
args.input_channels *
args.channel_multiplier;
113 ld_weight_col = (ld_weight_col == 0) ? input_channels : ld_weight_col;
114 ld_weight_row = (ld_weight_row == 0) ? packing_args.
kernel_cols * ld_weight_col : ld_weight_row;
116 const unsigned int vl =
120 for (
unsigned int n = 0; n < input_channels; n += vl)
122 const unsigned int todo = std::min(vl, input_channels - n);
126 if (biases !=
nullptr)
141 for (
int kindex = 0; packing_args.
get_weight_pos(kindex, kx, ky); kindex++)
143 const auto src_ptr = weights + (kx*ld_weight_row + ky*ld_weight_col + n) * packing_args.
weight_element_size;