-
Notifications
You must be signed in to change notification settings - Fork 8
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 elementwise max/min conversation and test case #92
Conversation
@@ -211,6 +211,8 @@ def _MakeMinOrMaxOp(ctx, op_type, inputs, outputs, output_shapes=None, output_dt | |||
|
|||
@flow_op("broadcast_minimum", onnx_op="Min") | |||
@flow_op("broadcast_maximum", onnx_op="Max") | |||
@flow_op("elementwise_minimum", onnx_op="Min") | |||
@flow_op("elementwise_maximum", onnx_op="Max") | |||
class MinMaxOp: | |||
@classmethod | |||
def Version_1(cls, ctx, node, **kwargs): |
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.
这里我有个疑问,我看 https://github.com/onnx/onnx/blob/main/docs/Changelog.md#Min-1 提到 Version 1 的 Min,是不支持 broadcast 的,所以在下面 _MakeMinOrMaxOp
里做了一些处理。
然而后面较高版本的 onnx op (比如 12 https://github.com/onnx/onnx/blob/main/docs/Changelog.md#Min-12)又支持 broadcast 了。
不过自定义的 trick 好像又够用了,这个是不是暂时就不用添加更高版本的映射了?
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.
是的
@@ -34,6 +34,7 @@ def forward(self, x: flow.Tensor) -> flow.Tensor: | |||
y3 = flow.acos(y3) | |||
y3 = flow.pow(y3, 2.0) | |||
y2 = y2 + y3 | |||
flow.minimum(y2, y3) |
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.
cpu那里的测试也对应加一下吧
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.
done
No description provided.