Created
January 22, 2019 14:50
-
-
Save holmesal/b1e69da3cc3bc6514163312e3778367f 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 LinearRegressionModel(nn.Module): | |
def __init__(self): | |
super(LinearRegressionModel, self).__init__() | |
# init the layers | |
self.layers = nn.Sequential( | |
# input linear layer | |
nn.Linear(1, 10), | |
# "rectified linear unit" or "replace negatives with zeroes" | |
nn.ReLU(inplace=True), | |
# batch norm | |
nn.BatchNorm1d(num_features=10), | |
# output linear layer | |
nn.Linear(10, 1) | |
) | |
# fastai passes both x_cat and x_cont - we can just ignore x_cat | |
def forward(self, x_cat: Tensor, x_cont: Tensor): | |
# pass x_cont into the network | |
return self.layers(x_cont); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment