Answers.Body: <blockquote>
  <p>How should I interpret or visualize this fact intuitively?</p>
  </blockquote>
  <p>You could visualize it as a point in a geometrical space:</p>
  <ul>
  <li><code>8</code> is just a number</li>
  <li><code>[8]</code> is just a number in a line</li>
  <li><code>[[8]]</code> is a number in a plane</li>
  <li><code>[[[8]]]</code> is a number in a space</li>
  </ul>
  <p>The object (number 8) won't change. The space around it changes.</p>
  <ul>
  <li>You can <strong>never</strong> represent a complex object (3d-cube) in a simpler shape (2d-plane).</li>
  <li>But you can <strong>always</strong> represent a simpler object (2d-square) in a higher dimensional shape (3d-space).</li>
  </ul>
  <p>A number is a simplest possible object, and therefore it &quot;fits inside&quot; (can be represented in) any dimension.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-08-15T17:10:59.247Z
Answers.LastActivityDate: 2022-01-18T23:30:11.060Z
Answers.LastEditDate: 2022-01-18T23:30:11.060Z
Answers.UserDisplayName: Andre Goulart
Answers.Body: <p>The number is <strong>not</strong> repeated if it is the only element of some high dimensional space.</p>
  <p>An <span class="math-container">$n$</span>-dimensional (vector) space is a set of objects (known as vectors, although this term is more commonly used to refer to the objects in <span class="math-container">$1$</span>-dimensional spaces), which are <strong>ordered/organized/shaped</strong> in specific ways, but composed of scalars/numbers, and to which you can also apply certain operations.</p>
  <p>It may be a good idea to think that the shape/organization of each object in an <span class="math-container">$n$</span>-d space is determined by some &quot;container&quot;, which has a certain shape, and that the container of the objects of higher-dimensional spaces generalizes (or it can include) the containers of lower-dimensional spaces.</p>
  <ul>
  <li><p>In the case of a <span class="math-container">$0$</span>-dimensional space (e.g. <span class="math-container">$\mathbb{R}$</span>), there's no container because you don't need it, as every object is composed of <strong>only one number</strong> (this is always the case!).</p>
  </li>
  <li><p>In the case of <span class="math-container">$1$</span>-dimensional spaces, an object <em>could</em> be composed of more than one number (but this does not have to be always the case: it depends on the specific <span class="math-container">$1$</span>-d space, so there are many <span class="math-container">$1$</span>-d spaces), so you need a way to organized these numbers. You organize them in a sequence that follows some direction. So, the objects <span class="math-container">$[0] \in \mathbb{R}^1$</span>, <span class="math-container">$[1, 2] \in \mathbb{R}^2$</span>, <span class="math-container">$[2, 3, 1] \in \mathbb{R}^3$</span>, <span class="math-container">$[0, 4, 2, 2] \in \mathbb{R}^4$</span>, etc., are all <span class="math-container">$1$</span>-d objects because  each of them is composed of <strong>one or more</strong> numbers, which are organized in sequence. <span class="math-container">$\mathbb{R}^1$</span>, <span class="math-container">$\mathbb{R}^2$</span>, <span class="math-container">$\mathbb{R}^3$</span>, etc., are all <span class="math-container">$1$</span>-d spaces, because they organize each of their objects in a sequence: their only difference is the number of numbers/scalars in each object.</p>
  </li>
  <li><p>In the case of <span class="math-container">$2$</span>-d spaces, you organize the objects not in a line, but in a rectangle. The rectangles can have different shapes, so they are not necessarily just squares. So, <span class="math-container">$[0] \in \mathbb{R}^{1 \times 1}$</span>, <span class="math-container">$ \begin{bmatrix} 1 &amp; 1\end{bmatrix} \in \mathbb{R}^{1 \times 2}$</span>, <span class="math-container">$ \begin{bmatrix} 1 &amp; 1 \\ 0 &amp; 2\end{bmatrix} \in \mathbb{R}^{1 \times 2}$</span>.</p>
  </li>
  <li><p>In the case of <span class="math-container">$3$</span>-d spaces, you organize each object into cuboids. This does not mean that these cuboids contain more than one number. In general, they could, but you also have cuboids that contain only one number, i.e. <span class="math-container">$[0] \in \mathbb{R}^{1 \times 1 \times 1}$</span>, which, in PyTorch, would be printed as <code>[[[0]]]</code> to give you the idea that the number <code>0</code> is inside a container <code>[0]</code>, which is inside another container <code>[ ]</code>, which can contain only one small container that can contain only one number (e.g. <code>[0]</code>, but you could also have had <code>[1]</code> or <code>[10]</code>), which is inside another container <code>[   ]</code>, which can contain only one container, which can contain only another container, which, in turn, can contain only one number.</p>
  </li>
  </ul>
  <p>To give you an analogy, think of having many boxes of different sizes and also have balls that you can put inside the smallest boxes. These boxes are the &quot;containers&quot; and the balls are the numbers. You can put smaller boxes inside the bigger ones (such that the boxes cannot slide around) and you can put the balls inside only the smallest boxes (so that they do not move).</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-08-11T13:13:06.063Z
Answers.LastActivityDate: 2021-08-11T13:34:46.013Z
Answers.LastEditDate: 2021-08-11T13:34:46.013Z
Answers.UserDisplayName: nbro
Body: <p>Consider the following code in PyTorch</p>
  <pre><code>&gt;&gt;&gt;torch.tensor([8]).shape
  torch.Size([1])
  &gt;&gt;&gt;torch.tensor([[8]]).shape
  torch.Size([1, 1])
  &gt;&gt;&gt;torch.tensor([[[8]]]).shape
  torch.Size([1, 1, 1])   
  </code></pre>
  <p>We can notice that we want to store only a single element <span class="math-container">$8$</span> in a tensor. But it is possible in tensors to store <span class="math-container">$8$</span> in any n-dimensional tensor where <span class="math-container">$n \in \mathbb{N}$</span>. In strict case <span class="math-container">$\mathbb{N}$</span> may be replaced by <span class="math-container">$\mathbb{W}$</span>.</p>
  <p>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.</p>
  <p>How to understand this phenomenon? How should I interpret or visualize this fact intuitively?</p>
  
Tags: <tensor><dimensionality>
Title: How to visually or intuitively understand single element multi-dimensional tensors?
UserDisplayName: hanugm
ThreadText: # How to visually or intuitively understand single element multi-dimensional tensors?
  
  (Asked by: username_0 on 2021-08-10)
  
  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?
  
  **Tags:** tensor, dimensionality
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2021-08-15. Score: 2
  
  > How should I interpret or visualize this fact intuitively?
  
  You could visualize it as a point in a geometrical space:
  
  * `8` is just a number
  * `[8]` is just a number in a line
  * `[[8]]` is a number in a plane
  * `[[[8]]]` is a number in a space
  
  The object (number 8) won't change. The space around it changes.
  
  * You can **never** represent a complex object (3d-cube) in a simpler shape (2d-plane).
  * But you can **always** represent a simpler object (2d-square) in a higher dimensional shape (3d-space).
  
  A number is a simplest possible object, and therefore it "fits inside" (can be represented in) any dimension.
  
  
  ---
  
  ### Answer by username_2 on 2021-08-11. Score: 1
  
  The number is **not** repeated if it is the only element of some high dimensional space.
  
  An $n$-dimensional (vector) space is a set of objects (known as vectors, although this term is more commonly used to refer to the objects in $1$-dimensional spaces), which are **ordered/organized/shaped** in specific ways, but composed of scalars/numbers, and to which you can also apply certain operations.
  
  It may be a good idea to think that the shape/organization of each object in an $n$-d space is determined by some "container", which has a certain shape, and that the container of the objects of higher-dimensional spaces generalizes (or it can include) the containers of lower-dimensional spaces.
  
  * In the case of a $0$-dimensional space (e.g. $\mathbb{R}$), there's no container because you don't need it, as every object is composed of **only one number** (this is always the case!).
  * In the case of $1$-dimensional spaces, an object *could* be composed of more than one number (but this does not have to be always the case: it depends on the specific $1$-d space, so there are many $1$-d spaces), so you need a way to organized these numbers. You organize them in a sequence that follows some direction. So, the objects $[0] \in \mathbb{R}^1$, $[1, 2] \in \mathbb{R}^2$, $[2, 3, 1] \in \mathbb{R}^3$, $[0, 4, 2, 2] \in \mathbb{R}^4$, etc., are all $1$-d objects because each of them is composed of **one or more** numbers, which are organized in sequence. $\mathbb{R}^1$, $\mathbb{R}^2$, $\mathbb{R}^3$, etc., are all $1$-d spaces, because they organize each of their objects in a sequence: their only difference is the number of numbers/scalars in each object.
  * In the case of $2$-d spaces, you organize the objects not in a line, but in a rectangle. The rectangles can have different shapes, so they are not necessarily just squares. So, $[0] \in \mathbb{R}^{1 \times 1}$, $ \begin{bmatrix} 1 & 1\end{bmatrix} \in \mathbb{R}^{1 \times 2}$, $ \begin{bmatrix} 1 & 1 \\ 0 & 2\end{bmatrix} \in \mathbb{R}^{1 \times 2}$.
  * In the case of $3$-d spaces, you organize each object into cuboids. This does not mean that these cuboids contain more than one number. In general, they could, but you also have cuboids that contain only one number, i.e. $[0] \in \mathbb{R}^{1 \times 1 \times 1}$, which, in PyTorch, would be printed as `[[[0]]]` to give you the idea that the number `0` is inside a container `[0]`, which is inside another container `[ ]`, which can contain only one small container that can contain only one number (e.g. `[0]`, but you could also have had `[1]` or `[10]`), which is inside another container `[ ]`, which can contain only one container, which can contain only another container, which, in turn, can contain only one number.
  
  To give you an analogy, think of having many boxes of different sizes and also have balls that you can put inside the smallest boxes. These boxes are the "containers" and the balls are the numbers. You can put smaller boxes inside the bigger ones (such that the boxes cannot slide around) and you can put the balls inside only the smallest boxes (so that they do not move).
  
  
  ---
  
  