cornellius-gp / linear_operator

A LinearOperator implementation to wrap the numerical nuts and bolts of GPyTorch

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug] Passing `other: Tensor` to `LinearOperator.to`.

j-wilson opened this issue Β· comments

πŸ› Bug

torch.Tensor.to allows the user to provide a reference tensor in lieu of explicitly passing device and dtype; however, this logic seems to be missing from LinearOperator.to.

To reproduce

A = DiagLinearOperator(torch.rand(3, dtype=torch.float64))
B = A.to(torch.rand(3, dtype=torch.float32))
B.dtype
> torch.float64

Expected Behavior

The code should either follow the same convention as torch.Tensor.to or raise an exception.