Jittor/jittor

官方文档相比于TensorFlow和PyTorch过于简单,很多API的描述没有写明参数之间的约束

PhyllisJi opened this issue · 0 comments

下列API的实现代码中都包含许多断言,作者应该仿照PyTorch和TensorFlow的做法,把对应断言的约束在文档中写清楚,这更有利于初学者去调试代码

jittor.nn.ReflectionPad2d等一系列和Pad相关的API

AssertionError: padding_left and padding_right should be smaller than input width
AssertionError: padding_top and padding_bottom should be smaller than input height

jittor.nn.PixelShuffle

AssertionError: input channel needs to be divided by upscale_factor's square in PixelShuffle

jittor.nn.Conv2d等一系列卷积API

AssertionError: out_channels must be divisible by groups
AssertionError: in_channels must be divisible by groups

jittor.nn.ConvTranspose等一系列API

AssertionError: output padding must be smaller than max(stride, dilation)

jittor.nn.GroupNorm

    assert C % self.num_groups == 0
Traceback (most recent call last):
  File "/home/moco_jt2/test.py", line 47, in <module>
    print(go())
  File "/home/moco_jt2/test.py", line 40, in go
    y = m(x)
  File "/root/miniconda3/envs/myconda/lib/python3.9/site-packages/jittor/__init__.py", line 1168, in __call__
    return self.execute(*args, **kw)
  File "/home/moco_jt2/test.py", line 30, in execute
    x = self.layer8_mutated(x)
  File "/root/miniconda3/envs/myconda/lib/python3.9/site-packages/jittor/__init__.py", line 1168, in __call__
    return self.execute(*args, **kw)
  File "/root/miniconda3/envs/myconda/lib/python3.9/site-packages/jittor/nn.py", line 817, in execute
    x = x.reshape((N, self.num_groups, C//self.num_groups, -1))
  File "/root/miniconda3/envs/myconda/lib/python3.9/site-packages/jittor/__init__.py", line 644, in reshape
    return origin_reshape(x, shape)
RuntimeError: Wrong inputs arguments, Please refer to examples(help(jt.ops.reshape)).

Types of your inputs are:
 self   = module,
 args   = (Var, tuple, ),

The function declarations are:
 VarHolder* reshape(VarHolder* x,  NanoVector shape)

Failed reason:[f 0829 07:07:34.156075 04 reshape_op.cc:50] Check failed: y_items != 0 && x_items % y_items == 0  reshape shape is invalid for input of size  618496