torch.Storage
A torch.Storage
is a contiguous, one-dimensional array of a single
data type.
Every torch.Tensor
has a corresponding storage of the same data type.
-
class
torch.
FloatStorage
(*args, **kwargs)[source] -
-
cuda
(device=None, non_blocking=False, **kwargs) Returns a copy of this object in CUDA memory.
If this object is already in CUDA memory and on the correct device, then no copy is performed and the original object is returned.
- Parameters
device (int) – The destination GPU id. Defaults to the current device.
non_blocking (bool) – If
True
and the source is in pinned memory, the copy will be asynchronous with respect to the host. Otherwise, the argument has no effect.**kwargs – For compatibility, may contain the key
async
in place of thenon_blocking
argument.
-
static
from_file
(filename, shared=False, size=0) → Storage If shared is True, then memory is shared between all processes. All changes are written to the file. If shared is False, then the changes on the storage do not affect the file.
size is the number of elements in the storage. If shared is False, then the file must contain at least size * sizeof(Type) bytes (Type is the type of storage). If shared is True the file will be created if needed.
Moves the storage to shared memory.
This is a no-op for storages already in shared memory and for CUDA storages, which do not need to be moved for sharing across processes. Storages in shared memory cannot be resized.
Returns: self
-
type
(dtype=None, non_blocking=False, **kwargs) Returns the type if dtype is not provided, else casts this object to the specified type.
If this is already of the correct type, no copy is performed and the original object is returned.
- Parameters
dtype (type or string) – The desired type
non_blocking (bool) – If
True
, and the source is in pinned memory and destination is on the GPU or vice versa, the copy is performed asynchronously with respect to the host. Otherwise, the argument has no effect.**kwargs – For compatibility, may contain the key
async
in place of thenon_blocking
argument. Theasync
arg is deprecated.
-