What doesn't pytorch support negative slicing?

Fei_Liu: <p>e.g. <code>x[::-1]</code> is not allowed.</p>
<pre><code class="lang-auto">ValueError: step must be greater than zero
</code></pre>
<p>Are there any special design reasons from the beginning that supporting this brings in some technical difficulties? There are also some issue trackers that go back and forth for years on this question, e.g.:</p><aside class="onebox githubissue" data-onebox-src="https://github.com/pytorch/pytorch/issues/59786">
  <header class="source">

      <a href="https://github.com/pytorch/pytorch/issues/59786" target="_blank" rel="noopener nofollow ugc">github.com/pytorch/pytorch</a>
  </header>

  <article class="onebox-body">
    <div class="github-row">
  <div class="github-icon-container" title="Issue">
	  <svg width="60" height="60" class="github-icon" viewbox="0 0 14 16" aria-hidden="true"><path fill-rule="evenodd" d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"></path></svg>
  </div>

  <div class="github-info-container">
    <h4>
      <a href="https://github.com/pytorch/pytorch/issues/59786" target="_blank" rel="noopener nofollow ugc">Support negative step sizes for slicing</a>
    </h4>

    <div class="github-info">
      <div class="date">
        opened <span class="discourse-local-date" data-format="ll" data-date="2021-06-10" data-time="11:44:07" data-timezone="UTC">11:44AM - 10 Jun 21 UTC</span>
      </div>


      <div class="user">
        <a href="https://github.com/pmeier" target="_blank" rel="noopener nofollow ugc">
          <img alt="pmeier" src="https://avatars.githubusercontent.com/u/6849766?v=4" class="onebox-avatar-inline" width="20" height="20">
          pmeier
        </a>
      </div>
    </div>

    <div class="labels">
        <span style="display:inline-block;margin-top:2px;background-color: #B8B8B8;padding: 2px;border-radius: 4px;color: #fff;margin-left: 3px;">
          triaged
        </span>
        <span style="display:inline-block;margin-top:2px;background-color: #B8B8B8;padding: 2px;border-radius: 4px;color: #fff;margin-left: 3px;">
          module: python array api
        </span>
    </div>
  </div>
</div>

  <div class="github-row">
    <p class="github-body-container">The [array API specification stipulates](https://data-apis.org/array-api/latest/<span class="show-more-container"><a href="" rel="noopener" class="show-more">…</a></span><span class="excerpt hidden">API_specification/indexing.html#slice-syntax) that the slicing syntax needs to be equivalent to Pythons [`slice()`](https://docs.python.org/3/library/functions.html#slice) syntax. That includes negative step sizes that PyTorch does not support:

```python
import torch

t = torch.rand((3,))
t[::-1]
```

```
ValueError: step must be greater than zero
```

## Additional context

This was already proposed in #229, but finally dismissed in https://github.com/pytorch/pytorch/issues/229#issuecomment-548092342 in favor of `torch.flip()`. Note that this is only a substitution for a negative step size of 1 (`::-1`) rather than negative step sizes in general.


cc @mruberry @rgommers @pmeier</span></p>
  </div>

  </article>

  <div class="onebox-metadata">
    
    
  </div>

  <div style="clear: both"></div>
</aside>

<p><code>torch.flip</code> is for sure one work around, but it has an extra copy that are not necessary most of the times. The main question is, what stops us from the negative slicing? It seems so common (and natural) in other numerical packages (<code>numpy</code> and many other things) and I cannot really come up with any valid reason on skipping the support in pytorch.</p>