CoolFace
Apppublic

ShAnSantosh/Chatbot_Using_Pytorch

sourceHugging Faceapache-2.0updated 4y agoView on Hugging Face
2likes
model.py20 linesDownload Raw Back to root
1import torch2import torch.nn as nn3 4 5class NeuralNet(nn.Module):6    def __init__(self, input_size, hidden_size, num_classes):7        super(NeuralNet, self).__init__()8        self.l1 = nn.Linear(input_size, hidden_size) 9        self.l2 = nn.Linear(hidden_size, hidden_size) 10        self.l3 = nn.Linear(hidden_size, num_classes)11        self.relu = nn.ReLU()12    13    def forward(self, x):14        out = self.l1(x)15        out = self.relu(out)16        out = self.l2(out)17        out = self.relu(out)18        out = self.l3(out)19        # no activation and no softmax at the end20        return out