-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Add More Shape Functions #4179
Add More Shape Functions #4179
Conversation
7e17e4a
to
779e087
Compare
oshape.Set(2, (dshape_nchw[2] + param->padding[0] * 2 | ||
- dilated_ksize_y) / param->strides[0] + 1); | ||
} else { | ||
oshape.Set(2, dshape_nchw[2]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
f775105
to
ae156fe
Compare
axis_record = _create_axis_record(attrs, inputs) | ||
return [_reduce_shape_func(inputs[0], convert(axis_record))] | ||
|
||
_reg.register_shape_func("argmax", False, reduce_shape_func) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I get it correctly, all function in this file has reduce_schedule and reduce_shape_func.
can we use a for loop instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Registering schedule/shapefunc line by line should be cleaner when later we introduce some ops which require different sch/shapefunc implementation. Also this way is adopted across all relay op files. I think it's a good idea to keep them consistent
3978aef
to
01a3665
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks @kevinthesun |
* Add shape functions * Fix get_const_tuple * Fix cpplint * Fix pylint * Fix pylint * rebase and fix * Check Any for infer type * Fix expand_dim shape func for zero rank input * Fix pooling infer type * Address comment * Register layout transform attr
minor: would it be better to call it |
I would prefer register_rt_shape_func or just keep register_shape_func. Is it bad to think it is similar to type_rel? |
Add shape functions for:
nn: conv2d_NCHWc, pool2d, global_pool2d, batch_flatten, dense, pad, relu, bias_add, softmax.
transform: layout_transform, expand_dim, transpose, squeeze, reshape_like
tensor: elemwise
reduce
Also fix some type inference to support dynamic shape.
Related RFC: #4118
@icemelon9 @wweic @yongwww