Support for slicing with a step != 1?
Currently when attempting to slice a tensor or Variable object with a step different from 1 I get a Runtime Error: Is support for this opperation coming anytime soon and what is the best way to reverse a tensor along an axis currently? Best I can come up with is doing it via index_select which is clunky and copies the tensor… Doing it via numpy is also not possible as from_numpy() doesn’t seem to work with negative strides.
Ajoo
apaszke
So how do I flip the image?
acgtyrant
acgtyrant
Strange it sometimes work, and sometimes doesn’t: <SCODE>tensor([[-0.8948],
            [-0.3556],
            [ 1.2324],
            [ 0.1382],
            [-1.6822]])
<ECODE> <SCODE>_ ValueError                                Traceback (most recent call last)_
_ <ipython-input-42-67cae86c60db> in <module>_
_torch.mm(features, torch.reshape(weights, weights[::-1]))_
_ ValueError: negative step not yet supported_
<ECODE> <SCODE>tensor([[-0.8948],
            [-0.3556],
            [ 1.2324],
            [ 0.1382],
            [-1.6822]])
<ECODE>
bobiblazeski
Hi guys, I am also facing the same issue. Could anyone please confirm if the issue is resolved?
Shriya_Kak
Which issue? negative strides? I’m afraid we do not support it.
albanD
<SCODE>detected_faces = face_detector.detect_from_image(data[..., ::-1].copy())
<ECODE> ValueError: negative step not yet supported This is what I am getting.
Shriya_Kak
Hi,
albanD