Skip to content

Instantly share code, notes, and snippets.

@ayoubbenaissa
Created February 21, 2019 17:58
Show Gist options
  • Save ayoubbenaissa/5efa8a7dc8a66d3897ffd26658f315f0 to your computer and use it in GitHub Desktop.
Save ayoubbenaissa/5efa8a7dc8a66d3897ffd26658f315f0 to your computer and use it in GitHub Desktop.
pytorch tuto
#create class:
class LinearRegressionModel (nn.Module):
def __init__(self, input_size, output_size):
super(LinearRegressionModel, self).__init__()
self.linear = nn.Linear(1, 1)
def forward(self, x):
out = self.linear(x)
return out
#create object (instance from the class)
model = LinearRegressionModel(1, 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment