Skip to main content
added 3 characters in body; edited tags
Source Link
hanugm
  • 4k
  • 3
  • 28
  • 59

Consider the following code in PyTorch

>>>torch.tensor([8]).shape
torch.Size([1])
>>>torch.tensor([[8]]).shape
torch.Size([1, 1])
>>>torch.tensor([[[8]]]).shape
torch.Size([1, 1, 1])   

We can notice that we want to store only a single element $8$ in a tensor. But it is possible in tensors to store $8$ in any n-dimensional tensor where $n \in \mathbb{N}$. In strict case $\mathbb{N}$ may be replaced by $\mathbb{W}$.

But, I am facing difficulty in understanding this fact of a single element contributing to all dimensions. If the element is present in all dimensions, then I am assuming that it has to be present multiple times, which is not the case. I can't understand how a single element is contributing any number of dimensions without repeating itself multiple times.

How to understand this phenomenon? How should I interpret or visualize this fact intuitively?

Consider the following code in PyTorch

>>>torch.tensor([8]).shape
torch.Size([1])
>>>torch.tensor([[8]]).shape
torch.Size([1, 1])
>>>torch.tensor([[[8]]]).shape
torch.Size([1, 1, 1])   

We can notice that we want to store only a single element $8$ in a tensor. But it is possible in tensors to store $8$ in any n-dimensional tensor where $n \in \mathbb{N}$. In strict case $\mathbb{N}$ may be replaced by $\mathbb{W}$.

But, I am facing difficulty in understanding this fact of a single element contributing to all dimensions. If the element is present in all dimensions, then I am assuming that it has to present multiple times, which is not the case. I can't understand how a single element is contributing any number of dimensions without repeating itself multiple times.

How to understand this phenomenon? How should I interpret or visualize this fact intuitively?

Consider the following code in PyTorch

>>>torch.tensor([8]).shape
torch.Size([1])
>>>torch.tensor([[8]]).shape
torch.Size([1, 1])
>>>torch.tensor([[[8]]]).shape
torch.Size([1, 1, 1])   

We can notice that we want to store only a single element $8$ in a tensor. But it is possible in tensors to store $8$ in any n-dimensional tensor where $n \in \mathbb{N}$. In strict case $\mathbb{N}$ may be replaced by $\mathbb{W}$.

But, I am facing difficulty in understanding this fact of a single element contributing to all dimensions. If the element is present in all dimensions, then I am assuming that it has to be present multiple times, which is not the case. I can't understand how a single element is contributing any number of dimensions without repeating itself multiple times.

How to understand this phenomenon? How should I interpret or visualize this fact intuitively?

edited body
Source Link
hanugm
  • 4k
  • 3
  • 28
  • 59

Consider the following code in PyTorch

>>>torch.tensor([8]).shape
torch.Size([1])
>>>torch.tensor([[8]]).shape
torch.Size([1, 1])
>>>torch.tensor([[[8]]]).shape
torch.Size([1, 1, 1])   

We can notice that we want to store only a single element $8$ in a tensor. But it is possible in tensors to store $8$ in any n-dimensional tensor where $n \in \mathbb{N}$. In strict case $\mathbb{N}$ may be replaced by $\mathbb{W}$.

But, I am facing difficulty in understanding thethis fact of a single element contributing to all dimensions. If the element is present in all dimensions, then I am assuming that it has to presentpresent multiple times, which is not the case. I can't understand how a single element is contributing any number of dimensions without repeating itself multiple times.

How to understand this phenomenon? How should I interpret or visualize this fact intuitively?

Consider the following code in PyTorch

>>>torch.tensor([8]).shape
torch.Size([1])
>>>torch.tensor([[8]]).shape
torch.Size([1, 1])
>>>torch.tensor([[[8]]]).shape
torch.Size([1, 1, 1])   

We can notice that we want to store only a single element $8$ in a tensor. But it is possible in tensors to store $8$ in any n-dimensional tensor where $n \in \mathbb{N}$. In strict case $\mathbb{N}$ may be replaced by $\mathbb{W}$.

But, I am facing difficulty in understanding the fact of a single element contributing to all dimensions. If the element is present in all dimensions, then I am assuming that it has to present multiple times, which is not the case. I can't understand how a single element is contributing any number of dimensions without repeating itself multiple times.

How to understand this phenomenon? How should I interpret or visualize this fact intuitively?

Consider the following code in PyTorch

>>>torch.tensor([8]).shape
torch.Size([1])
>>>torch.tensor([[8]]).shape
torch.Size([1, 1])
>>>torch.tensor([[[8]]]).shape
torch.Size([1, 1, 1])   

We can notice that we want to store only a single element $8$ in a tensor. But it is possible in tensors to store $8$ in any n-dimensional tensor where $n \in \mathbb{N}$. In strict case $\mathbb{N}$ may be replaced by $\mathbb{W}$.

But, I am facing difficulty in understanding this fact of a single element contributing to all dimensions. If the element is present in all dimensions, then I am assuming that it has to present multiple times, which is not the case. I can't understand how a single element is contributing any number of dimensions without repeating itself multiple times.

How to understand this phenomenon? How should I interpret or visualize this fact intuitively?

Source Link
hanugm
  • 4k
  • 3
  • 28
  • 59

How to visually or intuitively understand single element multi-dimensional tensors?

Consider the following code in PyTorch

>>>torch.tensor([8]).shape
torch.Size([1])
>>>torch.tensor([[8]]).shape
torch.Size([1, 1])
>>>torch.tensor([[[8]]]).shape
torch.Size([1, 1, 1])   

We can notice that we want to store only a single element $8$ in a tensor. But it is possible in tensors to store $8$ in any n-dimensional tensor where $n \in \mathbb{N}$. In strict case $\mathbb{N}$ may be replaced by $\mathbb{W}$.

But, I am facing difficulty in understanding the fact of a single element contributing to all dimensions. If the element is present in all dimensions, then I am assuming that it has to present multiple times, which is not the case. I can't understand how a single element is contributing any number of dimensions without repeating itself multiple times.

How to understand this phenomenon? How should I interpret or visualize this fact intuitively?