Deep Learningのモデル
import torch
from torch import nn
import torch.nn.functional as F
class Model(nn.Module):
def __init__(self):
super(Model, self).__init__()
self.linear1 = nn.Linear(27, 10)
self.linear2 = nn.Linear(10, 2)
def forward(self, x):
batch_size = x.shape[0]
x = self.linear1(x)
x = F.relu(x)
x = self.linear2(x)
x = F.sigmoid(x)
out = torch.log_softmax(x, dim=1)
return out