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

jittor.nn.LSTMCell无法对非法输入做出正确反应 #468

Open
PhyllisJi opened this issue Jul 20, 2023 · 0 comments
Open

jittor.nn.LSTMCell无法对非法输入做出正确反应 #468

PhyllisJi opened this issue Jul 20, 2023 · 0 comments

Comments

@PhyllisJi
Copy link

关键错误信息

当jittor.nn.LSTMCell输入不符合所定义input_size时,形状错误会被正常抛出。但是当输入一个可以进行乘算,但是维度不正确的输入时,jittor.nn.LSTMCell会接受这个输入,并导致底层算子出现溢出问题

预期行为

jittor.nn.LSTMCell应该对任何错误输入进行检查,并提供给用户正确的异常信息。

错误日志

Traceback (most recent call last):
  File "D:\PythonProjects\venv\lib\site-packages\IPython\core\interactiveshell.py", line 3508, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-24-66c14f5c2312>", line 1, in <module>
    y = p(x)
  File "D:\PythonProjects\venv\lib\site-packages\jittor\__init__.py", line 1168, in __call__
    return self.execute(*args, **kw)
  File "D:\PythonProjects\venv\lib\site-packages\jittor\nn.py", line 2406, in execute
    f = y[:, self.hidden_size : 2 * self.hidden_size].sigmoid()
  File "D:\PythonProjects\venv\lib\site-packages\jittor\contrib.py", line 192, in getitem
    return x.getitem(slices)
RuntimeError: Wrong inputs arguments, Please refer to examples(help(jt.getitem)).
Types of your inputs are:
 self	= Var,
 args	= (tuple, ),
The function declarations are:
 VarHolder* getitem(VarHolder* x,  VarSlices&& slices)
 vector_to_tuple<VarHolder*> getitem_(VarHolder* x,  VarSlices&& slices,  int _)
Failed reason:[f 0711 21:48:11.652000 88 nano_vector.h:32] Check failed: start==stop || (start>=0 && stop>=-1 && start<size && stop<=size)  Something wrong... Could you please report this issue?
 slice overflow: 20 2 1

最小复现

p = jittor.nn.LSTMCell(input_size=1, hidden_size=20)
x = jittor.randn(28,2,1,1)
y = p(x)
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

1 participant