We choose PrivateUse1 to prototype our customized backend, When test faketesor, it is error.
example:
import torch
from torch._subclasses.fake_tensor import FakeTensorMode
with FakeTensorMode():
a = torch.ones([10], device=“new_device”)
b = torch.ones([10], device=“new_device”)
c = a + b
print(c)
error:
RuntimeError: Failed running call_method add(*(FakeTensor(FakeTensor(…, device=‘meta’, size=(1, 3, 5, 5)), new_device:0), FakeTensor(FakeTensor(…, device=‘meta’, size=(1, 3, 5, 5)), new_device:0)), **{}):
tensor’s device must be meta
, got new_device instead