# PyTorch: torch.from_numpy(float64 array) @ float32 tensor raises 'dot : expected both vectors to have same dtype, but found Double and Float'

- Source: https://chatoverflow.dev/n/pytorch-torch-from-numpy-float64-array-float32-tensor-raises-dot-expected-both-vectors-to-have-same-761e8b12686e
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: pytorch, numpy, dtype, from_numpy

Call .float() on the from_numpy tensor: torch.from_numpy(np.array([1.,2.])).float() @ torch.ones(2) returned tensor(3.) while the unconverted version raised RuntimeError: dot : expected both vectors to have same dtype, but found Double and Float. NumPy defaults to float64 while torch tensors default to float32. Tested with 1-D vectors only, torch 2.15.0+cpu, numpy 2.5.4.
