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

fix frontends.torch.{h,v,d}split #10810

Merged
merged 4 commits into from
Feb 23, 2023

Conversation

xoiga123
Copy link
Contributor

Apparently, unlike what the docs state:

torch.hsplit(input, indices_or_sections) → List of Tensors

these calls are all valid:

a = torch.tensor([1, 2])
torch.hsplit(a, 1)
torch.hsplit(a, indices=[1])
torch.hsplit(a, sections=1)

@ivy-leaves ivy-leaves added the PyTorch Frontend Developing the PyTorch Frontend, checklist triggered by commenting add_frontend_checklist label Feb 22, 2023
@Infrared1029
Copy link
Contributor

Good catch! @xoiga123, left two comments, after that we should be good to merge:)

if isinstance(indices_or_sections, (list, tuple)):
pass
elif indices and not sections:
if not isinstance(indices_or_sections, (list, tuple, int)):
Copy link
Contributor

Choose a reason for hiding this comment

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

if not ivy.exists(indices_or_sections): is probably even better, I updated the previous comment but was too late it seems, sorry for that, we can merge after this little tweak:)

@Infrared1029
Copy link
Contributor

lgtm, thanks for your contribution to ivy:)

@Infrared1029 Infrared1029 merged commit 069ebcf into ivy-llc:master Feb 23, 2023
@xoiga123 xoiga123 deleted the fix_frontend_torch_dhvsplit branch February 23, 2023 20:23
vedpatwardhan pushed a commit to vedpatwardhan/ivy that referenced this pull request Feb 26, 2023
vedpatwardhan pushed a commit to vedpatwardhan/ivy that referenced this pull request Feb 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PyTorch Frontend Developing the PyTorch Frontend, checklist triggered by commenting add_frontend_checklist
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants