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.

Subsections

  1. torch.TYPEStorage([size])
  2. [number] #self
  3. [number] self[index]
  4. [self] copy(storage)
  5. [self] fill(value)
  6. [self] resize(size [, keepContent])
  7. [number] size()
  8. [self] string(str)
  9. [string] string()
  10. torch.TYPEMapStorage(filename)