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

In correct torch.baddbmm when beta=0 #52

Open
roastduck opened this issue Jun 20, 2024 · 1 comment
Open

In correct torch.baddbmm when beta=0 #52

roastduck opened this issue Jun 20, 2024 · 1 comment

Comments

@roastduck
Copy link

Quoated from the PyTorch doc:

If beta is 0, then input will be ignored, and nan and inf in it will not be propagated.

But torch_musa propagates nan.

>>> import torch              
>>> import torch_musa         
>>> dev = torch.device('musa')
>>> inp = torch.full((8, 8, 8), float('nan'), dtype=torch.float16).to(dev)
>>> batch1 = torch.zeros((8, 8, 8), dtype=torch.float16).to(dev)          
>>> batch2 = torch.zeros((8, 8, 8), dtype=torch.float16).to(dev)          
>>> torch.baddbmm(inp, batch1, batch2, beta=0)                            
tensor([[[nan, nan, nan, nan, nan, nan, nan, nan],                        
         [nan, nan, nan, nan, nan, nan, nan, nan],                        
         [nan, nan, nan, nan, nan, nan, nan, nan],                        
         [nan, nan, nan, nan, nan, nan, nan, nan],                        
         [nan, nan, nan, nan, nan, nan, nan, nan],                        
         [nan, nan, nan, nan, nan, nan, nan, nan],                        
         [nan, nan, nan, nan, nan, nan, nan, nan],                        
         [nan, nan, nan, nan, nan, nan, nan, nan]],                       

(more outputs are omitted)

Tested with torch_musa 1.1.0+fb1871f.

@hanhaowen-mt
Copy link
Collaborator

thank you! we are fixing it!

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

2 participants