Rate this Page

torch.is_storage#

torch.is_storage(obj, /)[source]#

Returns True if obj is a PyTorch storage object.

Parameters:

obj (Object) – Object to test

Return type:

TypeIs[TypedStorage | UntypedStorage]

Example:

>>> x = torch.tensor([1, 2, 3])
>>> torch.is_storage(x)
False
>>> torch.is_storage(x.untyped_storage())
True