A Tensor being a way of viewing a Storage, it is possible to "set" a Tensor such that it views an existing Storage.

Note that if you want to perform a set on an empty Tensor like

y = torch.DoubleStorage(10)
x = torch.Tensor()
x:set(y, 1, 10)
you might want in that case to use one of the equivalent constructor.
y = torch.DoubleStorage(10)
x = torch.Tensor(y, 1, 10)

Subsections

  1. [self] set(tensor)
  2. [self] set(storage, storageOffset, sizes, [strides])
  3. [self] set(storage, storageOffset, sz1 [, st1 ... [, sz4 [, st4]]])