Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PyTorch torch.is_storage function

PyTorch torch.is_storage function


PyTorch torch reference manual PyTorch torch reference manual

torch.is_storage A function in PyTorch for checking whether an object is a storage object.

Function definition

torch.is_storage(obj)


Usage examples

Example

import

torch

Creating tensors

x

=

torch.

tensor

(

[

1

,

2

,

3

]

)

Check whether it is a storage object

print

(

torch.

is_storage

(

x

)

)

print

(

torch.

is_storage

(

x.

storage

(

)

)

)

The output is:

False

True


PyTorch torch reference manual PyTorch torch reference manual