Closed x0w3n closed 3 months ago
The upscale_factor of jt.nn.PixelShuffle can be set to a negative value, resulting in a crash
[i 0512 08:15:23.157513 48 compiler.py:956] Jittor(1.3.9.6) src: /jittor/python/jittor [i 0512 08:15:23.159901 48 compiler.py:957] g++ at /usr/bin/g++(8.3.0) [i 0512 08:15:23.159971 48 compiler.py:958] cache_path: /root/.cache/jittor/jt1.3.9/g++8.3.0/py3.7.4/Linux-5.15.153x56/13thGenIntelRCx56/8c5a/master [i 0512 08:15:23.163950 48 __init__.py:412] Found addr2line(2.31.1) at /usr/bin/addr2line. [i 0512 08:15:23.384136 48 __init__.py:227] Total mem: 15.43GB, using 5 procs for compiling. [i 0512 08:15:23.453642 48 jit_compiler.cc:28] Load cc_path: /usr/bin/g++ Traceback (most recent call last): File "test.py", line 87, in <module> output = pixel_shuffle(input) File "/jittor/python/jittor/__init__.py", line 1184, in __call__ return self.execute(*args, **kw) File "/jittor/python/jittor/nn.py", line 1773, in execute f"i3/{r}" RuntimeError: Wrong inputs arguments, Please refer to examples(help(jt.reindex)). Types of your inputs are: self = Var, args = (list, list, ), The function declarations are: VarHolder* reindex(VarHolder* x, NanoVector shape, vector<string>&& indexes, float64 overflow_value=0, vector<string>&& overflow_conditions={}, vector<VarHolder*>&& extras={}) VarHolder* reindex_(VarHolder* x, vector<VarHolder*>&& indexes, float64 overflow_value=0, vector<string>&& overflow_conditions={}) Failed reason:[f 0512 08:15:23.568341 48 parallel_compiler.cc:331] Error happend during compilation: [Error] source file location:/root/.cache/jittor/jt1.3.9/g++8.3.0/py3.7.4/Linux-5.15.153x56/13thGenIntelRCx56/8c5a/master/jit/__opkey0_reindex__Tx_float32__XDIM_4__YDIM_4__OVERFLOW_itof_0x0___INDEX0_i0__INDEX1_i1_1_i___hash_53ede3cdeabe0bb1_op.cc Compile fused operator(1/2)failed:[Op(3:1:1:1:i1:o1:s0:g1,reindex->4),] Reason: [f 0512 08:15:23.566799 68:C0 expr.cc:170] Check failed: is_unary_op.count(op) Something wrong... Could you please report this issue? % is not unary op
import jittor as jt from jittor import * pixel_shuffle = jt.nn.PixelShuffle(upscale_factor=-1) input = jt.randn(1,2,3,4) output = pixel_shuffle(input)
Should be replaced by runtime error instead of direct crash
Describe the bug
The upscale_factor of jt.nn.PixelShuffle can be set to a negative value, resulting in a crash
Full Log
Minimal Reproduce
Expected behavior
Should be replaced by runtime error instead of direct crash