Description
The Building Models with PyTorch tutorial has a deprecated nn.Softmax() call and uses outdated Python 2-style super() syntax.
Changes needed
Deprecated APIs
nn.Softmax() → nn.Softmax(dim=1): Calling Softmax() without dim raises a UserWarning: "Implicit dimension choice for softmax has been deprecated." Specify the appropriate dimension explicitly.
Outdated patterns
- Python 2-style
super() → super().__init__(): Update 3 classes:
super(TinyModel, self).__init__() → super().__init__()
super(LeNet, self).__init__() → super().__init__()
super(LSTMTagger, self).__init__() → super().__init__()
Files
cc @subramen
Description
The Building Models with PyTorch tutorial has a deprecated
nn.Softmax()call and uses outdated Python 2-stylesuper()syntax.Changes needed
Deprecated APIs
nn.Softmax()→nn.Softmax(dim=1): CallingSoftmax()withoutdimraises aUserWarning: "Implicit dimension choice for softmax has been deprecated." Specify the appropriate dimension explicitly.Outdated patterns
super()→super().__init__(): Update 3 classes:super(TinyModel, self).__init__()→super().__init__()super(LeNet, self).__init__()→super().__init__()super(LSTMTagger, self).__init__()→super().__init__()Files
beginner_source/introyt/modelsyt_tutorial.pycc @subramen