title: Explanation for slicing in Pytorch
body: <p>why is the output same every time?</p>
  
  <pre><code>a = torch.tensor([0, 1, 2, 3, 4])
  a[-2:] = torch.tensor([[[5, 6]]])
  a
  </code></pre>
  
  <p>tensor([0, 1, 2, 5, 6])</p>
  
  <pre><code>a = torch.tensor([0, 1, 2, 3, 4])
  a[-2:] = torch.tensor([[5, 6]])
  a
  </code></pre>
  
  <p>tensor([0, 1, 2, 5, 6])</p>
  
  <pre><code>a = torch.tensor([0, 1, 2, 3, 4])
  a[-2:] = torch.tensor([5, 6])
  a
  </code></pre>
  
  <p>tensor([0, 1, 2, 5, 6])</p>