Skip to content

bug in fancy slicing #151

@ghennequin

Description

@ghennequin
open Nx

let x = randn float32 [| 3; 2 |]
let y = slice [ L [1; 2; 0]; A ] x

let _ = print x
let _ = print y

it appears that fancy slicing does nothing:

Nx Info:
  Shape: [3; 2]
  Dtype: float32
  Strides: [2; 1]
  Offset: 0
  Size: 6
  Data: [[-0.114142, 0.0526384],
         [-1.02858, 1.56206],
         [-0.293303, -0.572624]]

Nx Info:
  Shape: [3; 2]
  Dtype: float32
  Strides: [2; 1]
  Offset: 0
  Size: 6
  Data: [[-0.114142, 0.0526384],
         [-1.02858, 1.56206],
         [-0.293303, -0.572624]]

But note that e.g. slice [ L [ 2; 1 ]; A ] x works as expected (extracts the 3rd and 2nd rows of x in this order).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions