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

how to auto convert back to bfloat16 after conv1 and conv2 #8454

Open
ghost opened this issue Dec 5, 2024 · 1 comment
Open

how to auto convert back to bfloat16 after conv1 and conv2 #8454

ghost opened this issue Dec 5, 2024 · 1 comment

Comments

@ghost
Copy link

ghost commented Dec 5, 2024

❓ Questions and Help

I have an tensor with dtype torch.bfloat16, in kaggle v3-8, after the conv1 and conv2 operation the return type is torch.float32. Any way (environent varable or so) to convert the return type back to torch.bfloat16?

@radna0
Copy link

radna0 commented Dec 25, 2024

@ghost Environment variables such as XLA_USE_BF16/XLA_DOWNCAST_BF16, is now deprecated and not needed anymore. The conv is lightly returning in float because of precision reasons, best to just do .to(torch.bfloat16) if the tensor is still on the xla device. If precision does not matter a lot, you can try converting the conv to bfloat16/modifying its forward pass to return bfloat16 tensor

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

1 participant