mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Added is_xla (#103100)
This change creates `is_xla` which is congruent with `is_cuda` and `is_cpu`. Useful in situations like: https://github.com/pytorch/pytorch/pull/102858 ``` >>> x = torch.tensor([1], device=xm.xla_device()) >>> x.is_xla True >>> x.is_cpu False >>> x = torch.tensor([1]) >>> x.is_cpu True >>> x.is_xla False ``` Attn: @albanD Pull Request resolved: https://github.com/pytorch/pytorch/pull/103100 Approved by: https://github.com/albanD
This commit is contained in:
committed by
PyTorch MergeBot
parent
49dc26435f
commit
4e204ff87b
@ -6603,6 +6603,13 @@ Is ``True`` if the Tensor is stored on the CPU, ``False`` otherwise.
|
||||
""",
|
||||
)
|
||||
|
||||
add_docstr_all(
|
||||
"is_xla",
|
||||
r"""
|
||||
Is ``True`` if the Tensor is stored on an XLA device, ``False`` otherwise.
|
||||
""",
|
||||
)
|
||||
|
||||
add_docstr_all(
|
||||
"is_ipu",
|
||||
r"""
|
||||
|
Reference in New Issue
Block a user