downsample2d: Downsample a batch of 2D images using the given 2D FIR...

View source: R/upfirdn2d.R

downsample2dR Documentation

Downsample a batch of 2D images using the given 2D FIR filter.

Description

By default, the result is padded so that its shape is a fraction of the input. User-specified padding is applied on top of that, with negative values indicating cropping. Pixels outside the image are assumed to be zero.

Usage

downsample2d(
  x,
  f,
  down = 2,
  padding = 0,
  flip_filter = FALSE,
  gain = 1,
  impl = if (cuda_is_available()) "cuda" else "ref"
)

Arguments

x

Float32/float64/float16 input tensor of the shape c(batch_size, num_channels, in_height, in_width).

f

Float32 FIR filter of the shape c(filter_height, filter_width) (non-separable), filter_taps (separable), or NULL (identity).

down

Integer downsampling factor. Can be a single int or a vector c(x, y) (default: 1).

padding

Padding with respect to the upsampled image. Can be a single number or a vector c(x, y) or c(x_before, x_after, y_before, y_after) (default: 0).

flip_filter

FALSE = convolution, TRUE = correlation (default: FALSE).

gain

Overall scaling factor for signal magnitude (default: 1).

impl

Implementation to use. Can be 'ref' or 'cuda' (default: 'cuda' if torch::cuda_is_available() == TRUE, 'ref' otherwise).

Value

Tensor of the shape c(batch_size, num_channels, out_height, out_width).


rdinnager/styleganr documentation built on Nov. 9, 2022, 6:09 a.m.