Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Flatten --> Linear #6545

Merged
merged 1 commit into from Mar 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/guides/advanced/layer_and_model_cn.md
Expand Up @@ -420,9 +420,9 @@ for item in mylayer.named_sublayers():
('linear', Linear(in_features=784, out_features=10, dtype=float32))
```

可以看到,通过调用 `mylayer.sublayers()` 接口,打印出了前述模型中持有的全部子层(这时模型中只有一个 [paddle.nn.Flatten](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/nn/Flatten_cn.html) 子层)。
可以看到,通过调用 `mylayer.sublayers()` 接口,打印出了前述模型中持有的全部子层(这时模型中只有一个 [paddle.nn.Linear](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/nn/Linear_cn.html) 子层)。

而遍历 `mylayer.named_sublayers()` 时,每一轮循环会拿到一组 ( 子层名称('flatten'),子层对象(paddle.nn.Flatten) )的元组。
而遍历 `mylayer.named_sublayers()` 时,每一轮循环会拿到一组 ( 子层名称('linear'),子层对象(paddle.nn.Linear) )的元组。

### 5.2 向模型添加一个子层

Expand Down