-
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 instance_norm composite rule #52203
[Prim] Add instance_norm composite rule #52203
Conversation
… add_instance_norm_composite_rule
… add_instance_norm_composite_rule
你的PR提交成功,感谢你对开源项目的贡献! |
None, | ||
), | ||
( | ||
'test0_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.
add big shape case like [8,32,32,64]
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
… add_instance_norm_composite_rule
… add_instance_norm_composite_rule
var_tmp1 = difference * difference | ||
variance = mean(var_tmp1, axis=axis, keepdim=True) | ||
var_tmp3 = variance + epsilon | ||
sqrt_var = pow(var_tmp3, 0.5) |
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.
0.5 -> full(0.5)
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
var = mean((x-mean(x))^2) | ||
""" | ||
|
||
n, c, h, w = x.shape |
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 kernel is not supported by instance_norm op |
|
||
|
||
class TestInstanceNormOp(OpTest): | ||
def setUp(self): |
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.
这个测试cinn可以通过? 如果没问题请加一下这个文件到cmake里面去
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.
不能,已经设置flag
check_prim=True, | ||
) | ||
|
||
def test_check_output_gpu(self): |
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.
这个前向gpu测试跟cpu测试阈值都一样,把这两个测试合并了,统一调用check_output
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
core.CUDAPlace(0), atol=1e-05, check_prim=True | ||
) | ||
|
||
def test_check_grad_gpu(self): |
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.
这个反向也可以合并 调用check_grad
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
core.CPUPlace(), atol=1e-14, check_prim=True | ||
) | ||
|
||
def test_check_output_gpu(self): |
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.
这两个测试函数可以删了直接用父类的就行吧
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
… add_instance_norm_composite_rule
PR types
Others
PR changes
Others
Describe
Note: No fp16 kernel is registered,and this op only supports NC*.