Fix output size equations in Conv2D_cn.rst#7664
Open
inc4dge wants to merge 1 commit intoPaddlePaddle:developfrom
Open
Fix output size equations in Conv2D_cn.rst#7664inc4dge wants to merge 1 commit intoPaddlePaddle:developfrom
inc4dge wants to merge 1 commit intoPaddlePaddle:developfrom
Conversation
Correct mathematical equations for output height and width calculations in Conv2D documentation.
|
感谢你贡献飞桨文档,文档预览构建中,Docs-New 跑完后即可预览,预览链接:http://preview-pr-7664.paddle-docs-preview.paddlepaddle.org.cn/documentation/docs/zh/api/index_cn.html |
📚 本次 PR 文档预览链接(点击展开)
|
Collaborator
sunzhongkai588
left a comment
There was a problem hiding this comment.
想问下,为什么要改成这样的公式?
Author
导师您好, 因为原公式 "H_out = (H_in + stride - 1) / stride" 的主要问题在于它只考虑了步长,完全忽略了卷积核大小对输出尺寸的影响。同时,由于缺乏明确的取整规则,在多数情况下会得到小数结果(如输入32、步长3时得到10.66),导致输出尺寸模糊不清,从而引发计算错误。 例如,当输入尺寸为32×32,卷积核为3×3,步长为2时:
修改后的公式
向上取整的逻辑保证了即使最后剩余不足一个步长的像素区域,也会通过填充方式生成一个完整的输出位置,从而避免信息丢失。 |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
修改了数学公式从
“H_{out} = \frac{(H_{in} + stride[0] - 1)}{stride[0]}
W_{out} = \frac{(W_{in} + stride[1] - 1)}{stride[1]}”
到
“H_{out} = \lceil \frac{H_{in}}{stride[0]} \rceil
W_{out} = \lceil \frac{W_{in}}{stride[1]} \rceil”