In PyTorch, a regular tensor is a multi-dimensional array that is defined by the following components:

  • Storage: The actual data of the tensor, stored as a contiguous, one-dimensional array of bytes.
  • dtype: The data type of the elements in the tensor, such as torch.float32 or torch.int64.
  • shape: A tuple indicating the size of the tensor in each dimension.
  • Stride: The step size needed to move from one element to the next in each dimension.
  • Offset: The starting point in the storage from which the tensor data begins. This will usually be 0 for newly created tensors.