-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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 yaml and unittest for instance_norm op #43060
Add yaml and unittest for instance_norm op #43060
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
@@ -1030,6 +1030,17 @@ | |||
data_type : x | |||
backward : index_select_grad | |||
|
|||
- api : instance_norm | |||
args : (Tensor x, Tensor scale, Tensor bias, float epsilon) | |||
output : Tensor(y), Tensor(saved_mean), Tensor(saved_variance) |
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.
saved_mean和saved_variance需要配置成intermediate
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.
好的,下个pr修改
@@ -927,6 +927,29 @@ | |||
data_type : x | |||
no_need_buffer : x | |||
|
|||
- backward_api : instance_norm_double_grad | |||
forward : instance_norm_grad(Tensor x, Tensor fwd_scale, Tensor saved_mean, Tensor saved_variance, Tensor grad_y, float epsilon) -> Tensor(grad_x), Tensor(grad_scale), Tensor(grad_bias) | |||
args : (Tensor x, Tensor fwd_scale, Tensor saved_mean, Tensor saved_variance, Tensor grad_y, Tensor grad_x_grad, Tensor grad_scale_grad, Tensor grad_bias_grad, float epsilon) |
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.
fwd_scale这个命名方式在yaml配置里有些奇怪,可以直接用scale吗?
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.
不能,使用scale有编译问题,反向yaml自动生成代码还需要继续优化,报错经常和名字有关,配置yaml不方便
@@ -1404,7 +1404,7 @@ def GenerateNodeDefinition(self, next_grad_node_creation_str, | |||
const auto& out_metas = OutputMeta(); | |||
paddle::small_vector<std::vector<paddle::experimental::Tensor>, egr::kSlotSmallVectorSize> returns({slot_num_bwd_outputs}); | |||
for (int i = 0; i < {slot_num_bwd_outputs}; ++i) {{ | |||
returns[i].resize(out_metas[i].size()); | |||
out_metas[i].size() == 0 ? returns[i].resize(1) : returns[i].resize(out_metas[i].size()); |
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.
这里的修改是有什么特殊case吗?
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.
是的,输入是optional,且不需要计算其梯度的时候生成的代码有问题,会出segmentfault
* add yaml * fix infrt compile bugs
PR types
Others
PR changes
Others
Describe
为Instance norm添加新动态图使用的前反向yaml及单测。