35int32_t compute_output(
PaddingType padding, int32_t in_size, int32_t filter_size, int32_t stride,
58int16_t compute_padding(int32_t out_size, int32_t in_size, int32_t filter_size, int32_t stride,
78 if (_input_shape.
rank() != 4 || _filter_shape.
rank() != 4)
81 if (_bias_data && _bias_shape.
rank() != 1)
84 auto const input_batches = _input_shape.
dim(0).
value();
85 auto const input_height = _input_shape.
dim(1).
value();
86 auto const input_width = _input_shape.
dim(2).
value();
87 auto const input_depth = _input_shape.
dim(3).
value();
89 auto const filter_height = _filter_shape.
dim(1).
value();
90 auto const filter_width = _filter_shape.
dim(2).
value();
91 auto const filter_channels_out = _filter_shape.
dim(3).
value();
93 if (filter_channels_out % input_depth != 0)
96 if (_params.
depth_multiplier !=
static_cast<int32_t
>(filter_channels_out / input_depth))
99 if (_bias_shape.
dim(0).
value() != filter_channels_out)
102 auto output_height = compute_output(_params.
padding_type, input_height, filter_height,
104 if (output_height < 0)
107 auto output_width = compute_output(_params.
padding_type, input_width, filter_width,
109 if (output_width < 0)
114 _output_shape.
rank(4);
115 _output_shape.
dim(0) = input_batches;
116 _output_shape.
dim(1) = output_height;
117 _output_shape.
dim(2) = output_width;
118 _output_shape.
dim(3) = filter_channels_out;
121 compute_padding(output_height, input_height, filter_height, _params.
stride_height,