🎨 Format Python code with psf/black
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
""" Implementation of adaptive linear layer. """
|
||||
|
||||
import torch
|
||||
from torch.nn.parameter import Parameter
|
||||
|
||||
|
||||
class AdaptiveLinear(torch.nn.Module):
|
||||
'''
|
||||
"""
|
||||
Implementation of soft exponential activation.
|
||||
Shape:
|
||||
- Input: (N, *) where * means, any number of additional
|
||||
@@ -19,16 +20,16 @@ class AdaptiveLinear(torch.nn.Module):
|
||||
>>> 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(AdaptiveLinear, self).__init__()
|
||||
|
||||
self.scale = Parameter(torch.tensor(1.0))
|
||||
@@ -38,8 +39,8 @@ class AdaptiveLinear(torch.nn.Module):
|
||||
self.translate.requiresGrad = True # set requiresGrad to true!
|
||||
|
||||
def forward(self, x):
|
||||
'''
|
||||
"""
|
||||
Forward pass of the function.
|
||||
Applies the function to the input elementwise.
|
||||
'''
|
||||
"""
|
||||
return self.scale * (x + self.translate)
|
||||
|
||||
Reference in New Issue
Block a user