<h2 dir="auto">Issue description</h2>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&gt;&gt;&gt; a = torch.Tensor([1,2,3,4,5])
&gt;&gt;&gt; a -= a[0]
&gt;&gt;&gt; a
tensor([ 0.,  2.,  3.,  4.,  5.])"><pre class="notranslate"><code class="notranslate">&gt;&gt;&gt; a = torch.Tensor([1,2,3,4,5])
&gt;&gt;&gt; a -= a[0]
&gt;&gt;&gt; a
tensor([ 0.,  2.,  3.,  4.,  5.])
</code></pre></div>
<p dir="auto">This seems to be a very confusing result. Even though the below works. I think the above should at least do broadcasting or throw an exception? Now it is doing a confusing operation but silent.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&gt;&gt;&gt; a = torch.Tensor([1,2,3,4,5])
&gt;&gt;&gt; a -= a[0].item()
&gt;&gt;&gt; a
tensor([ 0.,  1.,  2.,  3.,  4.])"><pre class="notranslate"><code class="notranslate">&gt;&gt;&gt; a = torch.Tensor([1,2,3,4,5])
&gt;&gt;&gt; a -= a[0].item()
&gt;&gt;&gt; a
tensor([ 0.,  1.,  2.,  3.,  4.])
</code></pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="t = torch.range(1,10)
t[1:] = t[:-1] # wrong result
print(t)
t = torch.range(1,10)
t[1:] = t[:-1].clone() # right result
print(t)
t = torch.range(1, 10).numpy()
t[1:] = t[:-1] # right result
print(t)"><pre class="notranslate"><code class="notranslate">t = torch.range(1,10)
t[1:] = t[:-1] # wrong result
print(t)
t = torch.range(1,10)
t[1:] = t[:-1].clone() # right result
print(t)
t = torch.range(1, 10).numpy()
t[1:] = t[:-1] # right result
print(t)
</code></pre></div>
<p dir="auto">Note that the same (wrong?) behaviour is present in lua torch.</p>