mirror of
https://github.com/hpcaitech/ColossalAI.git
synced 2025-08-11 04:41:54 +00:00
[hotfix] meta tensor default device. (#2510)
This commit is contained in:
parent
077a5cdde4
commit
c198c7c0b0
@ -43,7 +43,7 @@ class MetaTensor(torch.Tensor):
|
|||||||
storage_offset=elem.storage_offset(),
|
storage_offset=elem.storage_offset(),
|
||||||
dtype=elem.dtype,
|
dtype=elem.dtype,
|
||||||
layout=elem.layout,
|
layout=elem.layout,
|
||||||
device=fake_device if fake_device is not None else torch.device('cpu'),
|
device=fake_device or (elem.device if elem.device.type != 'meta' else torch.device('cpu')),
|
||||||
requires_grad=elem.requires_grad) # deceive the frontend for aten selections
|
requires_grad=elem.requires_grad) # deceive the frontend for aten selections
|
||||||
r._tensor = elem
|
r._tensor = elem
|
||||||
# ...the real tensor is held as an element on the tensor.
|
# ...the real tensor is held as an element on the tensor.
|
||||||
|
Loading…
Reference in New Issue
Block a user