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

Multiplication of a float tensor and a bool tensor produces a bool tensor on PyTorch #686

Open
kazssym opened this issue Feb 2, 2025 · 0 comments

Comments

@kazssym
Copy link

kazssym commented Feb 2, 2025

Multiplying a float tensor and a bool tensor on DML produces a bool tensor which is expected to be a float tensor as on CPU.

import torch
import torch_directml

dml = torch_directml.device()

t1cpu = torch.Tensor([0, 1])
t1dml = t1cpu.to(dml)

t2cpu = t1cpu > 0
t2dml = t1dml > 0

t1cpu *= t2cpu
t1dml *= t2dml

print(t1cpu)
print(t1dml)

Output:

tensor([0., 1.])
tensor([False,  True], device='privateuseone:0')

Version:

torch                2.4.1
torch-directml       0.2.5.dev240914
@kazssym kazssym changed the title Multiplication of a float tensor and a bool tensor produces a bool tensor Multiplication of a float tensor and a bool tensor produces a bool tensor on PyTorch Feb 2, 2025
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