Tensor ellipsis indexing and step slicing
orlando-labs opened this issue · comments
Yvan commented
Hi, @ankane!
Working recently on some Fairseq models porting, I met the following line:
residual = residual[..., :: r_tsz // tsz][..., :tsz]
What can we do with such ellipsis indexing and step slicing while keeping Ruby clarity?
UPD: according to docs
It’s also important to note that index types such as None / Ellipsis / Slice live in the torch::indexing namespace
Andrew Kane commented
Hi @orlando-labs, there could probably be Torch::Ellipsis
and Torch::Slice
classes for this (similar to the C++ API). I'm not sure it would be especially Ruby-like, but would make it easier to port code.
Yvan commented
Looks like the only way to go.