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

Zero sized tensor support for repeat_interleave #23717

Closed
wants to merge 3 commits into from

Conversation

zasdfgbnm
Copy link
Collaborator

Fixes #22753

@zasdfgbnm
Copy link
Collaborator Author

Test failure is unrelated

@zasdfgbnm
Copy link
Collaborator Author

@pytorchbot rebase this please

Copy link
Contributor

@mrshenli mrshenli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix!

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mrshenli has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@mrshenli
Copy link
Contributor

mrshenli commented Aug 2, 2019

@pytorchbot rebase this please

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mrshenli has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

zdevito pushed a commit to zdevito/ATen that referenced this pull request Aug 5, 2019
Summary:
Fixes pytorch/pytorch#22753
Pull Request resolved: pytorch/pytorch#23717

Differential Revision: D16623598

Pulled By: mrshenli

fbshipit-source-id: 297a3274fb5a5b2fcc0c3ad601337d7eb29fdca2
@facebook-github-bot
Copy link
Contributor

@mrshenli merged this pull request in 520982d.

@gchanan
Copy link
Contributor

gchanan commented Aug 5, 2019

@zasdfgbnm is there a reason that this function (repeat(Tensor)) is exposed at all? It's not documented and it looks like an implementation detail.

@zasdfgbnm zasdfgbnm deleted the repeat_interleave_bug branch August 6, 2019 01:03
@zasdfgbnm
Copy link
Collaborator Author

@gchanan It is actually documented
image

It is part of an implementation detail, but I feel it useful and it would be good to expose this as a shorter and faster way of doing torch.arange(n).repeat_interleave(repeats) when I originally implement torch.repeat_interleave.

My personal use case for this is:
I have a packed sequence s = tensor([x1, x2, ..., xn, y1, y2, ..., ym, ....]) and a tensor storing the size of each sequence counts = tensor([n, m, ...]), and I want to have a tensor of the sequence id for each element in s. In this case, I would do a torch.repeat_interleave(counts).

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

Successfully merging this pull request may close these issues.

repeat_interleave throws IndexError on repeating size-zero dimension
7 participants