NumAdd-v1.0 / model.py
MultivexAI's picture
Upload model.py
e294b14 verified
raw
history blame contribute delete
553 Bytes
import torch
import torch.nn as nn
class AddModel(nn.Module):
"""
Input(2) -> Linear(32) -> ReLU -> Linear(64) -> ReLU -> Linear(1) -> Output
"""
def __init__(self):
super(AddModel, self).__init__()
self.fc1 = nn.Linear(2, 32)
self.relu1 = nn.ReLU()
self.fc2 = nn.Linear(32, 64)
self.relu2 = nn.ReLU()
self.fc3 = nn.Linear(64, 1)
def forward(self, x):
x = self.relu1(self.fc1(x))
x = self.relu2(self.fc2(x))
x = self.fc3(x)
return x