pub unsafe extern "C" fn nn_tensor_pad(
output: *mut NNTensor,
input: *mut NNTensor,
head: *const i32,
tail: *const i32,
constant: f64,
) -> NNErrorExpand description
nn_tensor_pad implements a padded Tensor to Tensor copy. This can be used to achieve the various convolution padding strategies (SAME, FULL). For example SAME conv2d would use the following padded_copy before running the conv2d layer.
output_shape = { input_shape[0], int(ceil(float(input_shape[1]) / strides[1])), int(ceil(float(input_shape[2]) / strides[2])), weights_shape[3] };
pad_height = (output_shape[1] - 1) * strides[1] + weights_shape[0] - input_shape[1]; pad_width = (output_shape[2] - 1) * strides[2] + weights_shape[1] - input_shape[2];
@output pointer to the output tensor @input pointer to the input tensor @head lead-in length of the pad for dimension NHWC @tail lead-out length of the pad for dimension NHWC
@public @memberof NNTensor @since 2.0