Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save n0obcoder/2861411e662657a9d482cf445bf35e27 to your computer and use it in GitHub Desktop.

Select an option

Save n0obcoder/2861411e662657a9d482cf445bf35e27 to your computer and use it in GitHub Desktop.
# Defining the model architecture.
class LinearRegressionModel(torch.nn.Module):
def __init__(self):
super(LinearRegressionModel, self).__init__()
self.linear = torch.nn.Linear(1, 1) # this layer of the model has a single neuron, that takes in one scalar input and gives out one scalar output.
def forward(self, x):
y_pred = self.linear(x)
return y_pred
# Creating the model
model = LinearRegressionModel()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment