Skip to content

Commit

Permalink
fix typo (ShusenTang#52): Block -> Module
Browse files Browse the repository at this point in the history
  • Loading branch information
zooltd authored and ShusenTang committed Oct 23, 2019
1 parent 737cf19 commit 97df534
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/chapter04_DL_computation/4.1_model-construction.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ from torch import nn
class MLP(nn.Module):
# 声明带有模型参数的层,这里声明了两个全连接层
def __init__(self, **kwargs):
# 调用MLP父类Block的构造函数来进行必要的初始化。这样在构造实例时还可以指定其他函数
# 调用MLP父类Module的构造函数来进行必要的初始化。这样在构造实例时还可以指定其他函数
# 参数,如“模型参数的访问、初始化和共享”一节将介绍的模型参数params
super(MLP, self).__init__(**kwargs)
self.hidden = nn.Linear(784, 256) # 隐藏层
Expand Down Expand Up @@ -75,7 +75,7 @@ class MySequential(nn.Module):
for idx, module in enumerate(args):
self.add_module(str(idx), module)
def forward(self, input):
# self._modules返回一个 OrderedDict,保证会按照成员添加时的顺序遍历成
# self._modules返回一个 OrderedDict,保证会按照成员添加时的顺序遍历成员
for module in self._modules.values():
input = module(input)
return input
Expand Down

0 comments on commit 97df534

Please sign in to comment.