Created
September 7, 2020 14:50
-
-
Save MLWhiz/d20a2cd7a0eab07039c51ce2dc3e6ca6 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 myCustomLinearLayer(nn.Module): | |
def __init__(self,in_size,out_size): | |
super().__init__() | |
self.weights = nn.Parameter(torch.randn(in_size, out_size)) | |
self.bias = nn.Parameter(torch.zeros(out_size)) | |
def forward(self, x): | |
return x.mm(self.weights) + self.bias |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment