Skip to content

Instantly share code, notes, and snippets.

@someshfengde
Created August 18, 2023 05:25
Show Gist options
  • Save someshfengde/2539ee772a827722368162d3441faa83 to your computer and use it in GitHub Desktop.
Save someshfengde/2539ee772a827722368162d3441faa83 to your computer and use it in GitHub Desktop.
import torch
import numpy as np
from tqdm import tqdm
import plotly.express as px # for visualisation
import plotly.io as pio
pio.renderers.default = 'iframe'
class LinearRegressor(torch.nn.Module):
"""
Building a simple linear regression model with pytorch
"""
def __init__(self):
super(LinearRegressor,self).__init__()
self.l1 = torch.nn.Linear(1,1) # setting up linear layer of 1 input and 1 output
def forward(self, x):
out = self.l1(x)
return out
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment