title: In PyTorch, what makes a tensor have non-contiguous memory?
body: <p>According to <a href="https://stackoverflow.com/questions/49643225">this SO</a> and <a href="https://discuss.pytorch.org/t/in-pytorch-0-4-is-it-recommended-to-use-reshape-than-view-when-it-is-possible/17034/2" rel="nofollow noreferrer">this PyTorch discussion</a>, PyTorch's <code>view</code> function works only on contiguous memory, while <code>reshape</code> does not. In the second link, the author even claims:</p>
  
  <blockquote>
    <p>[<code>view</code>] will raise an error on a non-contiguous tensor.</p>
  </blockquote>
  
  <p>But when does a tensor have non-contiguous memory?</p>