-
Notifications
You must be signed in to change notification settings - Fork 6.8k
net.Cast("float16") doesn't work: Check failed: (*in_type)[i] == dtype_param (2 vs. 0) : This layer requires uniform type. Expected 'float32' v.s. given 'float16' at 'gamma' #17164
Comments
I'm having a similar issue, but I guess this explains why the cast loses efficacy for BatchNorm layer?
so 'gamma' is still in float32, while the input is in float16, which causes the check failure. |
姐 他为啥这么设置啊 我都懵了 这不让BN转fp16? 我该咋训练和转化。。。 |
This is a known issue with BatchNorm operator not supporting float16. It needs some work to support, not currently a bug but not-implemented feature |
@mxnet-label-bot update [Feature request] |
BatchNorm is a “blacklist” function for which 16 bits of precision may not be sufficient. So you want to ensure that inputs into BatchNorm layer use float32, or you may have convergence issues. |
噢 这样子啊!谢谢小姐姐~( ̄▽ ̄~)~ 但是我心中有个疑问,batchnorm基本都是大量使用,该如何确保bn层的输入是fp32而其它算子是fp16呢。。。能否给个简单的代码样例 |
Then how does the current BatchNorm operator handle float16 inputs in mixed precision training? |
我也正有这个疑惑,正在研究中哈哈,弄明白了告诉你=w= |
Thank you! But I still doubt about it. BatchNorm doesn't support fp16, how can I train my model with fp16? |
嗯呢。话说方便的话能否留下个联系方式么 |
This error actually seems to come from the fact that the @Rainweic I would recommend looking into AMP for training: https://mxnet.apache.org/api/python/docs/tutorials/performance/backend/amp.html @zhreshold FYI |
Thank you! Let me try |
Description
When I use my dataset to trian Gluoncv's SSD with Float16, I meet this error:
Check failed: (*in_type)[i] == dtype_param (2 vs. 0) : This layer requires uniform type. Expected 'float32' v.s. given 'float16' at 'gamma'
I find in SSD, some BatchNormal Layers is use symbol to achieve. Because this,
net.cast('float16)
loses efficacy.Error Message
mxnet1.5.1:
Check failed: (*in_type)[i] == dtype_param (2 vs. 0) : This layer requires uniform type. Expected 'float32' v.s. given 'float16' at 'gamma'
To Reproduce
**Example 1**
Example 2
Steps to reproduce
What have you tried to solve it?
Example1
I don't know how to solve it
Example2
Change it like this:
Environment
ubuntu 18 mxnet1.5.1
mac mxnet1.5.1
The text was updated successfully, but these errors were encountered: