Tensordot does not support Bool

It seems that tensordot does not support tensors of dtype Bool (unlike numpy).
a = torch.tensor([[False, True], [False, True]])
b = torch.tensor([[False, True], [False, True]])
torch.tensordot(a, b, dims=1)
Traceback (most recent call last):
File “”, line 1, in
File “…\torch\functional.py”, line 705, in tensordot
return _VF.tensordot(a, b, dims_a, dims_b)
RuntimeError: _th_addmm_out not supported on CPUType for Bool

A possible workaround:
torch.tensordot(a.float(), b.float(), dims=1).bool()
requires doing redundant operations.

I believe, it would be useful for tensordot to support Bool.


You can check if there is already an issue asking for this feature.
But we will most likely be happy to accept a PR adding this.

Thanks. I Will do this.

Xref https://github.com/pytorch/pytorch/issues/44969