Skip to content
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

Merged

Conversation

rainyfly
Copy link
Contributor

@rainyfly rainyfly commented Mar 27, 2023

PR types

Others

PR changes

Others

Describe

  1. Add instance_norm composite rule base on PR51283

Note: No fp16 kernel is registered,and this op only supports NC*.

@paddle-bot
Copy link

paddle-bot bot commented Mar 27, 2023

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

None,
),
(
'test0_fp64',
Copy link
Contributor

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]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

var_tmp1 = difference * difference
variance = mean(var_tmp1, axis=axis, keepdim=True)
var_tmp3 = variance + epsilon
sqrt_var = pow(var_tmp3, 0.5)
Copy link
Contributor

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)

Copy link
Contributor Author

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

how about other data_format like nhwc?

@rainyfly
Copy link
Contributor Author

rainyfly commented Apr 6, 2023

fp16 kernel is not supported by instance_norm op



class TestInstanceNormOp(OpTest):
def setUp(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个测试cinn可以通过? 如果没问题请加一下这个文件到cmake里面去

Copy link
Contributor Author

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):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个前向gpu测试跟cpu测试阈值都一样,把这两个测试合并了,统一调用check_output

Copy link
Contributor Author

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):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个反向也可以合并 调用check_grad

Copy link
Contributor Author

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):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这两个测试函数可以删了直接用父类的就行吧

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

cyber-pioneer
cyber-pioneer previously approved these changes Apr 10, 2023
@cyber-pioneer cyber-pioneer merged commit b0f17d0 into PaddlePaddle:develop Apr 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants