message: CMSIS-NN: Dynamic allocation of conv per-channel quant params
  Fixes for convolution
  For models with channels greater than 256, out of bounds memory
  write happens resulting in undefined behaviour. This PR addresses
  this issue by dynamically allocating the per-channel params.
diff: @@ -36,7 +36,6 @@ constexpr int kInputTensor = 0;
  constexpr int kFilterTensor = 1;
  constexpr int kBiasTensor = 2;
  constexpr int kOutputTensor = 0;
  -constexpr int kMaxChannels = 256;
  // Conv is quantized along dimension 0:
  // https://www.tensorflow.org/lite/performance/quantization_spec
  @@ -56,9 +55,8 @@ struct OpData {
  int output_shift;
  // Per channel output multiplier and shift.
  - // TODO(b/141139247): Allocate these dynamically when possible.
  - int32_t per_channel_output_multiplier[kMaxChannels];
  - int32_t per_channel_output_shift[kMaxChannels];
  + int32_t* per_channel_output_multiplier;
  + int32_t* per_channel_output_shift;
  // The range of the fused activation layer. For example for kNone and
  // uint8_t these would be 0 and 255.
  @@ -159,6 +157,19 @@ TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
  output_dims.w = output->dims->data[2];
  output_dims.c = output_shape.Dims(3);
  + // Dynamically allocate per-channel quantization parameters.
  + // TODO(#43475): This allocation is done even for non-int8 cases to get around
  + // a bug in kernel_utils.cc which incorrectly uses per_channel_output_shift in
  + // non-int8 cases. Protect this section with a if (input->type == kTfLiteInt8)
  + // when the issue is fixed.
  + const int num_channels = filter->dims->data[kConvQuantizedDimension];
  + data->per_channel_output_multiplier =
  + reinterpret_cast<int32_t*>(context->AllocatePersistentBuffer(
  + context, num_channels * sizeof(int32_t)));
  + data->per_channel_output_shift =
  + reinterpret_cast<int32_t*>(context->AllocatePersistentBuffer(
  + context, num_channels * sizeof(int32_t)));
  +
  TF_LITE_ENSURE_STATUS(CalculateOpData(
  context, node, params, input_dims.w, input_dims.h, filter_dims.w,
  filter_dims.h, output_dims.w, output_dims.h, input->type, data));
  