🎨 Format Python code with psf/black
This commit is contained in:
@@ -3,7 +3,7 @@ from torch.nn.parameter import Parameter
|
||||
|
||||
|
||||
class AdaptiveReLU(torch.nn.Module, Parameter):
|
||||
'''
|
||||
"""
|
||||
Implementation of soft exponential activation.
|
||||
Shape:
|
||||
- Input: (N, *) where * means, any number of additional
|
||||
@@ -18,16 +18,16 @@ class AdaptiveReLU(torch.nn.Module, Parameter):
|
||||
>>> a1 = soft_exponential(256)
|
||||
>>> x = torch.randn(256)
|
||||
>>> x = a1(x)
|
||||
'''
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
'''
|
||||
"""
|
||||
Initialization.
|
||||
INPUT:
|
||||
- in_features: shape of the input
|
||||
- aplha: trainable parameter
|
||||
aplha is initialized with zero value by default
|
||||
'''
|
||||
"""
|
||||
super(AdaptiveReLU, self).__init__()
|
||||
|
||||
self.scale = Parameter(torch.rand(1))
|
||||
@@ -37,9 +37,9 @@ class AdaptiveReLU(torch.nn.Module, Parameter):
|
||||
self.translate.requiresGrad = True # set requiresGrad to true!
|
||||
|
||||
def forward(self, x):
|
||||
'''
|
||||
"""
|
||||
Forward pass of the function.
|
||||
Applies the function to the input elementwise.
|
||||
'''
|
||||
#x += self.translate
|
||||
"""
|
||||
# x += self.translate
|
||||
return torch.relu(x + self.translate) * self.scale
|
||||
|
||||
Reference in New Issue
Block a user