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

hasSideEffects INTERNAL ASSERT FAILED when using .split method with JIT #24243

Open
serhii-havrylov opened this issue Aug 13, 2019 · 7 comments
Labels
high priority oncall: jit Add this issue/PR to JIT oncall triage queue triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Comments

@serhii-havrylov
Copy link
Contributor

serhii-havrylov commented Aug 13, 2019

When using the code snippet bellow, I get this error: RuntimeError: kind_.is_prim() INTERNAL ASSERT FAILED at /pytorch/torch/csrc/jit/ir.cpp:904, please report a bug to PyTorch. Only prim ops are allowed to not have a registered operator but aten::cat doesn't have one either. We don't know if this op has side effects. (hasSideEffects at /pytorch/torch/csrc/jit/ir.cpp:904)

import torch
import numpy as np


@torch.jit.script
def get_loss(a, idxs):
    idxs = idxs.split(split_size=1, dim=1)
    b = a.index(idxs)
    return b.sum()


c = torch.zeros(3, 4, 5)
c.requires_grad = True
idxs = torch.tensor(np.array([[0, 1, 2],
                              [0, 0, 4],
                              [0, 2, 4],
                              [2, 3, 0]], dtype=np.long))

loss = get_loss(c, idxs)

If idxs.split(split_size=1, dim=1) replaced with list(idxs.split(split_size=1, dim=1)) the error disappears.
PyTorch version is 1.2.0

cc @ezyang @gchanan @suo

@facebook-github-bot facebook-github-bot added the oncall: jit Add this issue/PR to JIT oncall triage queue label Aug 13, 2019
@driazati driazati assigned driazati and smessmer and unassigned driazati Aug 13, 2019
@suo
Copy link
Member

suo commented Aug 22, 2019

@smessmer any progress on this? It repros for me

@suo suo added triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module high priority labels Aug 22, 2019
@eellison
Copy link
Contributor

The repro no longer errors, and there is another issue similar issue that is outstanding so I'm closing this.

@WGY907
Copy link

WGY907 commented Jun 9, 2020

I get this error ,RuntimeError: kind_.is_prim() INTERNAL ASSERT FAILED at /pytorch/torch/csrc/jit/ir.cpp:904, please report a bug to PyTorch. Only prim ops are allowed to not have a registered operator but aten::_convolution doesn't have one either. We don't know if this op has side effects. (hasSideEffects at /pytorch/torch/csrc/jit/ir.cpp:904)
How to deal with it
thanks a lot

@kjdorow7
Copy link

@WGY907, it looks like this problem goes away with newer PyTorch versions. I ran the above code with 1.5.1 and had no problems.

@n-gao
Copy link

n-gao commented Mar 17, 2021

@eellison This bug is not fixed! If you call get_loss a second time, it fails!

import torch
import numpy as np


@torch.jit.script
def get_loss(a, idxs):
    idxs = idxs.split(split_size=1, dim=1)
    b = a.index(idxs)
    return b.sum()


c = torch.zeros(3, 4, 5)
c.requires_grad = True
idxs = torch.tensor(np.array([[0, 1, 2],
                              [0, 0, 4],
                              [0, 2, 4],
                              [2, 3, 0]], dtype=np.long))

loss = get_loss(c, idxs)
loss = get_loss(c, idxs)
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-9-f6dfaf23fa61> in <module>
----> 1 loss = get_loss(c, idxs)

RuntimeError: kind_.is_prim() INTERNAL ASSERT FAILED at "/pytorch/torch/csrc/jit/ir/ir.cpp":1098, please report a bug to PyTorch. Only prim ops are allowed to not have a registered operator but aten::cat doesn't have one either. We don't know if this op has side effects.

Reproduced in PyTroch 1.8

@MohamedAliRashad
Copy link
Contributor

Is there any updates on this issue ?

@the5solae
Copy link

Any updates on this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
high priority oncall: jit Add this issue/PR to JIT oncall triage queue triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module
Projects
None yet
Development

No branches or pull requests