* @param[in] weights Weights tensor shape
* @param[in] info Padding and stride info
* @param[in] out_dims Output shape dimensions
- * @param[in] pad_left Padding on left
- * @param[in] pad_right Padding on right
- * @param[in] pad_top Padding on top
- * @param[in] pad_bottom Padding on bottom
+ * @param[in] invalid_right The number of zeros added to right edge of the output.
+ * @param[in] invalid_bottom The number of zeros added to bottom edge of the output.
+ * @param[out] pad_left Padding on left
+ * @param[out] pad_right Padding on right
+ * @param[out] pad_top Padding on top
+ * @param[out] pad_bottom Padding on bottom
*
* @return the calculated shape
*/
inline TensorShape compute_transposeconv_upsampled_shape(
const ITensorInfo &input, const ITensorInfo &weights, const PadStrideInfo &info,
- std::pair<unsigned int, unsigned int> &out_dims, unsigned int &pad_left,
- unsigned int &pad_right, unsigned int &pad_top, unsigned int &pad_bottom)
+ std::pair<unsigned int, unsigned int> &out_dims, unsigned int invalid_right,
+ unsigned int invalid_bottom, unsigned int &pad_left, unsigned int &pad_right,
+ unsigned int &pad_top, unsigned int &pad_bottom)
{
unsigned int sx = info.stride().first;
unsigned int sy = info.stride().second;
out_x += padx;
out_y += pady;
- unsigned int padx_all = padx + info.pad_left() + info.pad_right();
- unsigned int pady_all = pady + info.pad_top() + info.pad_bottom();
- pad_left = (padx_all + 1) / 2 - info.pad_left();
- pad_right = padx_all / 2 - info.pad_right();
- pad_top = (pady_all + 1) / 2 - info.pad_top();
- pad_bottom = pady_all / 2 - info.pad_bottom();
+ unsigned int padx_all_except_invallid = padx + info.pad_left() + info.pad_right() - invalid_right;
+ unsigned int pady_all_except_invallid =
+ pady + info.pad_top() + info.pad_bottom() - invalid_bottom;
+ pad_left = (padx_all_except_invallid + 1) / 2 - info.pad_left();
+ pad_right = pady_all_except_invallid / 2 - info.pad_right() + invalid_right;
+ pad_top = (padx_all_except_invallid + 1) / 2 - info.pad_top();
+ pad_bottom = pady_all_except_invallid / 2 - info.pad_bottom() + invalid_bottom;
TensorShape scale_out_shape(input.tensor_shape());
scale_out_shape.set(idx_w, out_x);
* @param[out] output Output tensor. The output has the same number of dimensions
* as the @p input.
* @param[in] info Contains padding and policies to be used in the
- * deconvolution, this is decribed in @ref PadStrideInfo.
- * @param[in] invalid_right The number of zeros added to right edge of the input.
- * @param[in] invalid_bottom The number of zeros added to top edge of the input.
+ * transpose convolution, this is decribed in @ref PadStrideInfo.
+ * @param[in] invalid_right The number of zeros added to right edge of the output.
+ * @param[in] invalid_bottom The number of zeros added to top edge of the output.
* @param[in] weights_info (Optional) Weights information needed for @ref
* CLConvolutionLayer, specifies if the weights tensor has been
* reshaped with @ref CLWeightsReshapeKernel.
* Same as @p input.
* @param[in] output Output tensor info. The output has the same number of dimensions
* as the @p input.
- * @param[in] info Contains padding and policies to be used in the deconvolution,
- * this is decribed in @ref PadStrideInfo.
- * @param[in] innvalid_right The number of zeros added to right edge of the input.
- * @param[in] invalid_bottom The number of zeros added to top edge of the input.
+ * @param[in] info Contains padding and policies to be used in the
+ * transpose convolution, this is decribed in @ref PadStrideInfo.
+ * @param[in] innvalid_right The number of zeros added to right edge of the output.
+ * @param[in] invalid_bottom The number of zeros added to top edge of the output.
* @param[in] weights_info (Optional) Weights information needed for @ref CLConvolutionLayer,
* specifies if the weights tensor has been reshaped with @ref
* CLWeightsReshapeKernel.
unsigned int pad_top = 0;
unsigned int pad_bottom = 0;
const TensorShape scale_out_shape = compute_transposeconv_upsampled_shape(
- *input, *weights, info, out_dims, pad_left, pad_right, pad_top, pad_bottom);
+ *input, *weights, info, out_dims, invalid_right, invalid_bottom, pad_left, pad_right, pad_top,
+ pad_bottom);
TensorInfo scale_out_info(input->clone()
->set_is_resizable(true)
.reset_padding()
unsigned int pad_top = 0;
unsigned int pad_bottom = 0;
const TensorShape scale_out_shape = compute_transposeconv_upsampled_shape(
- *input->info(), *weights->info(), info, out_dims, pad_left, pad_right, pad_top, pad_bottom);
+ *input->info(), *weights->info(), info, out_dims, invalid_right, invalid_bottom, pad_left,
+ pad_right, pad_top, pad_bottom);
TensorInfo scale_out_info(scale_out_shape, 1, input->info()->data_type(),
input->info()->quantization_info());
--- /dev/null
+MODELFILE_NAME="transpose_conv_valid_test.tflite"