View source: R/filtered_lrelu.R
filtered_lrelu | R Documentation |
Performs the following sequence of operations for each channel:
Add channel-specific bias if provided (b
).
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 upsampling FIR filter (fu
), shrinking it
so that the footprint of all output pixels lies within the input image.
Multiply each value by the provided gain factor (gain
).
Apply leaky ReLU activation function to each value.
Clamp each value between -clamp and +clamp, if clamp
parameter is provided.
Convolve the image with the specified downsampling FIR filter (fd
), shrinking
it so that the footprint of all output pixels lies within the input image.
Downsample the image by keeping every Nth pixel (down
).
The fused op is considerably more efficient than performing the same calculation
using standard PyTorch ops. It supports gradients of arbitrary order.
filtered_lrelu( x, fu = NULL, fd = NULL, b = NULL, up = 1, down = 1, padding = 0, gain = sqrt(2), slope = 0.2, clamp = NULL, flip_filter = FALSE, impl = if (cuda_is_available()) "cuda" else "ref" )
x |
Float32/float16/float64 input tensor of the shape
|
fu |
Float32 upsampling FIR filter of the shape
|
fd |
Float32 downsampling FIR filter of the shape
|
b |
Bias vector, or |
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 |
gain |
Overall scaling factor for signal magnitude (default: 1). |
slope |
Slope on the negative side of leaky ReLU (default: 0.2). |
clamp |
Maximum magnitude for leaky ReLU output (default: NULL). |
flip_filter |
|
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.