-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
[Prim] Add prod backward composite rule #51238
[Prim] Add prod backward composite rule #51238
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
… add_prod_backward_composite_rule
… add_prod_backward_composite_rule
… add_prod_backward_composite_rule
… add_prod_backward_composite_rule
… add_prod_backward_composite_rule
… add_prod_backward_composite_rule
… add_prod_backward_composite_rule
TestProd8DOp已禁用,因为unqueeze和reshape都不支持8D |
auto reshape_dim = std::vector<int64_t>(x_dim); | ||
for (auto i : axis_) { | ||
reshape_dim[i] = 1; | ||
} |
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.
use unsqueezeapi replace
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
self.inputs = {'X': np.random.random([]).astype("float64")} | ||
self.outputs = {'Out': self.inputs['X'].prod()} | ||
self.attrs = {'dim': [], 'reduce_all': True} | ||
# reduce doesn't support float64 in cinn. |
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.
will it raise error when test fp64 with other test(not 0D tensor) in cinn?
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.
fp64 added in test
|
||
|
||
class TestProd8DOp(OpTest): | ||
def setUp(self): | ||
self.op_type = "reduce_prod" | ||
self.python_api = raw_reduce_prod | ||
self.prim_op_type = "prim" |
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 don't test prim delete this
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
@@ -387,6 +393,7 @@ class TestProd6DOp(OpTest): | |||
def setUp(self): | |||
self.op_type = "reduce_prod" | |||
self.python_api = raw_reduce_prod | |||
self.prim_op_type = "prim" | |||
self.init_data_type() | |||
self.inputs = { | |||
'X': np.random.random((5, 6, 2, 3, 4, 2)).astype(self.data_type) |
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.
confirm all dtypes has been tested (FP16, FP32,Fp64)
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.
FP16 is not supported, Fp64 has been added
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.
… add_prod_backward_composite_rule
… add_prod_backward_composite_rule
… add_prod_backward_composite_rule
… add_prod_backward_composite_rule
… add_prod_backward_composite_rule
… add_prod_backward_composite_rule
… add_prod_backward_composite_rule
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
… add_prod_backward_composite_rule
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
PR types
Others
PR changes
OPs
Describe