8000 请问 batchnorm var 为 0 的时候是怎么处理的? · Issue #302 · Tencent/ncnn · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

请问 batchnorm var 为 0 的时候是怎么处理的? #302

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

Closed
ChunyanZhao opened this issue Mar 22, 2018 · 3 comments
Closed

请问 batchnorm var 为 0 的时候是怎么处理的? #302

ChunyanZhao opened this issue Mar 22, 2018 · 3 comments

Comments

@ChunyanZhao
Copy link

我在 batchnorm 的参数为 0 的时候,得到的输出是 nan,是不是需要做特殊设置?

@nihui
Copy link
Member
nihui commented Mar 24, 2018

mxnet 模型转换过来的?

@ChunyanZhao
Copy link
Author

从 caffe 转过来的, mean 和 var 全 0, scale 是 1 . 检查的时候发现是转换的时候出错, 在 caffe2ncnn.cpp 441行:
float scale_factor = 1 / binlayer.blobs(2).data().data()[0];
我转换的时候,读到的 binlayer.blobs(2).data().data()[0] 是 0.

@Josuercuevas
Copy link

If you check line 100 in file batch_norm_layer.cpp at the original caffe repo: BatchNorm layer, this problem when binlayer.blobs(2).data().data()[0] = 0 should be handled as follows:

float scale_factor = binlayer.blobs(2).data().data()[0] == 0 ? 0 : 1 / binlayer.blobs(2).data().data()[0];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
0