Hello all, i am a beginner in deep learning and try to make a custom activation function from sigmoid in pytorch . I have an error when trying to implementing that custom activation function in model.
def tempsigmoid(x):
nd=3.0
temp=nd/torch.log(torch.tensor(9.0)) # how to write in pytorch , cant use float
return F.sigmoid(x/(temp))
# CREATE MODEL
class MLP(nn.Module):
def __init__(self):
super(MLP, self).__init__()
self.layers = nn.Sequential(
nn.Linear(1024, 100),
nn.Sigmoid(),
nn.Linear(100, 8)
tempsigmoid()
)
def forward(self, x):
x = self.layers(x)
return x
Error comment :
tempsigmoid()
^
SyntaxError: invalid syntax
why this is happened?