Skip to content

Instantly share code, notes, and snippets.

@dmesquita
Last active October 25, 2017 12:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dmesquita/072b5999a022ec42ea12b149033de9d6 to your computer and use it in GitHub Desktop.
Save dmesquita/072b5999a022ec42ea12b149033de9d6 to your computer and use it in GitHub Desktop.
import torch
from torch.autograd import Variable
import torch.nn as nn
import torch.nn.functional as F
class OurNet(nn.Module):
def __init__(self, input_size, hidden_size, num_classes):
super(Net, self).__init__()
self.layer_1 = nn.Linear(n_inputs,hidden_size, bias=True)
self.relu = nn.ReLU()
self.layer_2 = nn.Linear(hidden_size, hidden_size, bias=True)
self.output_layer = nn.Linear(hidden_size, num_classes, bias=True)
def forward(self, x):
out = self.layer_1(x)
out = self.relu(out)
out = self.layer_2(out)
out = self.relu(out)
out = self.output_layer(out)
return out
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment