Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions beginner_source/introyt/modelsyt_tutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ class is a subclass of ``torch.Tensor``, with the special behavior that
class TinyModel(torch.nn.Module):

def __init__(self):
super(TinyModel, self).__init__()
super().__init__()

self.linear1 = torch.nn.Linear(100, 200)
self.activation = torch.nn.ReLU()
self.linear2 = torch.nn.Linear(200, 10)
self.softmax = torch.nn.Softmax()
self.softmax = torch.nn.Softmax(dim=1)

def forward(self, x):
x = self.linear1(x)
Expand Down Expand Up @@ -150,7 +150,7 @@ def forward(self, x):
class LeNet(torch.nn.Module):

def __init__(self):
super(LeNet, self).__init__()
super().__init__()
# 1 input image channel (black & white), 6 output channels, 5x5 square convolution
# kernel
self.conv1 = torch.nn.Conv2d(1, 6, 5)
Expand Down Expand Up @@ -249,7 +249,7 @@ def num_flat_features(self, x):
class LSTMTagger(torch.nn.Module):

def __init__(self, embedding_dim, hidden_dim, vocab_size, tagset_size):
super(LSTMTagger, self).__init__()
super().__init__()
self.hidden_dim = hidden_dim

self.word_embeddings = torch.nn.Embedding(vocab_size, embedding_dim)
Expand Down
Loading