Storages are basically a way for Lua
to access memory of a C
pointer
or array. A Storage
is an array of basic C
types. For arrays of
Torch
objects, use the Lua
tables.
Several Storage
classes for all the basic C
types exist and have the
following self-explanatory names: CharStorage
, ShortStorage
,
IntStorage
, LongStorage
, FloatStorage
, DoubleStorage
.
The most used one is DoubleStorage
, which is where the data is really stored
in a Tensor
.
Conversions between two Storage
type might be done using copy
:
x = torch.IntStorage(10):fill(1) y = torch.DoubleStorage(10):copy(x)
Storages are serializable.
MapStorage
is a child class of Storage
allowing you to
directly map the content of a file to a Storage
. MapStorages are not
serializable, and not resizable.