Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tensor ellipsis indexing and step slicing #37

Open
orlando-labs opened this issue Apr 25, 2023 · 2 comments
Open

Tensor ellipsis indexing and step slicing #37

orlando-labs opened this issue Apr 25, 2023 · 2 comments

Comments

@orlando-labs
Copy link
Contributor

orlando-labs commented Apr 25, 2023

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
@ankane
Copy link
Owner

ankane commented Apr 27, 2023

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.

@orlando-labs
Copy link
Contributor Author

Looks like the only way to go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants