Error in implementing custom activation function

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):
    temp=nd/torch.log(torch.tensor(9.0)) # how to write in pytorch , cant use float
    return F.sigmoid(x/(temp)) 

class MLP(nn.Module):
    def __init__(self):
        super(MLP, self).__init__()
        self.layers = nn.Sequential(
            nn.Linear(1024, 100),
            nn.Linear(100, 8)
    def forward(self, x):
        x = self.layers(x)
        return x

Error comment :


SyntaxError: invalid syntax

why this is happened?

You’ve forgotten to add a comma after nn.Linear(100, 8).

thank you for your reply, after i add comma, I tried to call function with tempsigmoid() but gives error it need 1 argument. When i tried using tempsigmoid(x) i have error in my data that said

TypeError: mul(): argument ‘other’ (position 1) must be Tensor, not numpy.ndarray. It means my data still in the form of numpy?

class CustomDataset(Dataset):
    def __init__(self, x, y, transform=None):
        self.x = torch.from_numpy(x).float()
        self.y = torch.from_numpy(y).float()
        self.transform = transform
    def __getitem__(self, index):
        x = self.x[index]
        y = self.y[index]
        if self.transform:
            x = self.transform(x)
        return x, y
    def __len__(self):
        return len(self.x)