Created
July 18, 2022 12:23
-
-
Save neelindresh/c210af6788098ed64402a7926f9f5769 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
class Model(torch.nn.Module): | |
def __init__(self,col_size): | |
super().__init__() | |
# using sequencial | |
self.seq=torch.nn.Sequential( | |
torch.nn.Linear(col_size,15), | |
torch.nn.ReLU(), | |
torch.nn.Linear(15,10), | |
torch.nn.ReLU(), | |
torch.nn.Linear(10,1) | |
) | |
#using torch layers | |
''' | |
self.linear_layer_1=torch.nn.Linear(col_size,15) | |
self.relu_1=torch.nn.ReLU() | |
self.linear_layer_2=torch.nn.Linear(15,10) | |
self.relu_2=torch.nn.ReLU() | |
self.linear_layer_3=torch.nn.Linear(10,1) | |
''' | |
def forward(self,x): | |
out=self.seq(x) | |
''' | |
out=self.relu_1(self.linear_layer_1(x)) | |
out=self.relu_12self.linear_layer_3(out)) | |
out=self.linear_layer_3(out) | |
''' | |
return torch.sigmoid(out) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment