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 fusion of convolution and batch normalization layers not preserving dtype #1246

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

wico-silva
Copy link
Contributor

Fixes the error:

Traceback (most recent call last):
  File "tools/demo.py", line 320, in <module>
    main(exp, args)
  File "tools/demo.py", line 290, in main
    model = fuse_model(model)
  File "YOLOX/yolox/utils/model_utils.py", line 92, in fuse_model
    m.conv = fuse_conv_and_bn(m.conv, m.bn)  # update conv
  File "YOLOX/yolox/utils/model_utils.py", line 74, in fuse_conv_and_bn
    fusedconv.bias.copy_(torch.mm(w_bn, b_conv.reshape(-1, 1)).reshape(-1) + b_bn)
RuntimeError: expected scalar type Half but found Float

when using --fp16 --fuse. To replicate the issue, run the command:

python tools/demo.py image -n yolox-tiny -c yolox_tiny.pth --device gpu --conf 0.01 --fp16 --fuse

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

Successfully merging this pull request may close these issues.

None yet

1 participant