[Python] Move elements up in a one dimensional torch tensor

Discussão em 'Python' iniciado por Stack, Julho 24, 2025.

  1. Stack

    Stack Membro Participativo

    If I have a torch tensor of the form [1.0, 2.0, 3.0, 4.0, 5.0, 6.0]

    roll simply moves the elements down [6.0, 1.0, 2.0, 3.0, 4.0, 5.0]

    I want it to roll the other way resulting in [2.0, 3.0, 4.0, 5.0, 6.0, 1.0] (in fact last element will be zero'd in this particular case)

    Inverse does a full reverse. What are my options please?

    Continue reading...

Compartilhe esta Página