Ascend / pytorch

Ascend PyTorch adapter (torch_npu). Mirror of https://gitee.com/ascend/pytorch

Home Page:https://ascend.github.io/docs/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

torch.Tensor.to(<int num>) failed on npu

statelesshz opened this issue Β· comments

πŸ› Bug Report

As per title. When I execute torch.ones(2).to(0), the following error occurs:

(inference) [root@node-35 inference]# python
Python 3.8.18 (default, Sep 11 2023, 13:19:25)
[GCC 11.2.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch, torch_npu
>>> torch.ones(2).to(3)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/miniconda3/envs/inference/lib/python3.8/site-packages/torch/cuda/__init__.py", line 289, in _lazy_init
    raise AssertionError("Torch not compiled with CUDA enabled")
AssertionError: Torch not compiled with CUDA enabled

Versions

# pip list | grep torch
torch              2.1.0
torch-npu          2.1.0.post20231207

Expected behavior

torch_npu supports torch.Tensor.to(<int num>

cc @ChuBoning

This is not supported now.