Returns a tensor which uses the existing DoubleStorage storage, starting at position storageOffset (>=1). The size of each dimension of the tensor is given by the LongStorage sizes.

The jump necessary to go from one element to the next one in each dimension is given by the optional argument LongStorage strides.If not given, or if some elements of strides are negative, the stride() will be computed such that the tensor is as contiguous as possible in memory.

For a number of dimension up to 4, you can use a convenience method.

Any modification in the elements of the Storage will have a impact on the elements of the new Tensor, and vice-versa. There is no memory copy!

-- creates a storage with 10 elements
> s = torch.DoubleStorage(10):fill(1)

  -- we want to see it as a 2x5 tensor
> sz = torch.LongStorage(2)
> sz[1] = 2; sz[2] = 5;
> x = torch.Tensor(s, 1, sz)
> print(x)

 1  1  1  1  1
 1  1  1  1  1
[torch.Tensor of dimension 2x5]
> x:zero()
> print(s) -- the storage contents have been modified
> print(s)
0
0
0
0
0
0
0
0
0
0
[torch.DoubleStorage of size 10]