void BiasAdd3D(T* im_data, const T* bias_data, const RuntimeShape& input_shape,
               float float_activation_min, float float_activation_max) {
  if (bias_data) {
    const int outer_size = input_shape.Dims(0) * input_shape.Dims(1) *
                           input_shape.Dims(2) * input_shape.Dims(3);
    const int num_channels = input_shape.Dims(4);
    for (int n = 0; n < outer_size; ++n) {
      for (int c = 0; c < num_channels; ++c) {
        im_data[c] = ActivationFunctionWithMinMax(im_data[c] + bias_data[c],
                                                  float_activation_min,
                                                  float_activation_max);
      }
      im_data += num_channels;
    }
  } else {
    const int flat_size = input_shape.FlatSize();
    for (int i = 0; i < flat_size; ++i) {
      im_data[i] = ActivationFunctionWithMinMax(
          im_data[i], float_activation_min, float_activation_max);
    }
  }
}
void BiasAdd3D(T* im_data, const T* bias_data, const RuntimeShape& input_shape,
               float float_activation_min, float float_activation_max) {
  if (bias_data) {
    const int outer_size = input_shape.Dims(0) * input_shape.Dims(1) *
                           input_shape.Dims(2) * input_shape.Dims(3);
    const int num_channels = input_shape.Dims(4);
    for (int n = 0; n < outer_size; ++n) {
      for (int c = 0; c < num_channels; ++c) {
        im_data[c] = ActivationFunctionWithMinMax(im_data[c] + bias_data[c],
                                                  float_activation_min,
                                                  float_activation_max);
      }
      im_data += num_channels;
    }
  } else {
    const int flat_size = input_shape.FlatSize();
    for (int i = 0; i < flat_size; ++i) {
      im_data[i] = ActivationFunctionWithMinMax(
          im_data[i], float_activation_min, float_activation_max);
    }
  }
}