nn_prelu {torch} | R Documentation |
PReLU module
Description
Applies the element-wise function:
or
Usage
nn_prelu(num_parameters = 1, init = 0.25)
Arguments
num_parameters |
(int): number of |
init |
(float): the initial value of |
Details
Here is a learnable parameter. When called without arguments,
nn.prelu()
uses a single
parameter across all input channels. If called with
nn_prelu(nChannels)
,
a separate is used for each input channel.
Shape
Input:
where
*
means, any number of additional dimensionsOutput:
, same shape as the input
Attributes
weight (Tensor): the learnable weights of shape (
num_parameters
).
Note
weight decay should not be used when learning for good performance.
Channel dim is the 2nd dim of input. When input has dims < 2, then there is no channel dim and the number of channels = 1.
Examples
if (torch_is_installed()) {
m <- nn_prelu()
input <- torch_randn(2)
output <- m(input)
}