upfirdn2d | R Documentation |
Performs the following sequence of operations for each channel:
Upsample the image by inserting N-1 zeros after each pixel (up
).
Pad the image with the specified number of zeros on each side (padding
).
Negative padding corresponds to cropping the image.
Convolve the image with the specified 2D FIR filter (f
), shrinking it
so that the footprint of all output pixels lies within the input image.
Downsample the image by keeping every Nth pixel (down
).
This sequence of operations bears close resemblance to scipy.signal.upfirdn().
The fused op is considerably more efficient than performing the same calculation
using standard PyTorch ops. It supports gradients of arbitrary order.
upfirdn2d( x, f, up = 1, down = 1, padding = 0, flip_filter = FALSE, gain = 1, impl = if (cuda_is_available()) "cuda" else "ref" )
x |
Float32/float64/float16 input tensor of the shape
|
f |
Float32 FIR filter of the shape
|
up |
Integer upsampling factor. Can be a single integer or a vector of integers
|
down |
Integer downsampling factor. Can be a single int or a vector
|
padding |
Padding with respect to the upsampled image. Can be a single number
or a vector |
flip_filter |
|
gain |
Overall scaling factor for signal magnitude (default: 1). |
impl |
Implementation to use. Can be |
Tensor of the shape c(batch_size, num_channels, out_height, out_width)
.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.