Created
August 18, 2023 05:25
-
-
Save someshfengde/2539ee772a827722368162d3441faa83 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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