Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR Category
Execute Infrastructure
PR Types
New features
Description
kron支持0-Size。
修改历程介绍如下:
前向修复:
a. 在Paddle代码中检索def kron,发现kron的核心实现调用的是_C_ops的kron
b. 以_C_ops的kron在paddle/phi/ops/yaml中检索,发现square的InferMeta函数使用到:
KronInferMeta
c. 在代码中检索KronInferMeta,并检查其dims(shape)的推导是否正确(是正确的)
d. 在paddle/phi/kernels中检索square,找全所有kron的实现Kernel。发现共有1个涉及kron的文件,为:
Paddle/paddle/phi/kernels/impl/kron_kernel_impl.h
加入VLOG发现,这一步的输入输出形状均正确,且判断numel为0 return问题没有解决,报错依旧存在
e. 排除正向计算的问题,问题应该出在反向传播:

在paddle/phi/ops/yaml中检索kron_grad,找到InferMeta函数为GeneralBinaryGradInferMeta
numel info - x: 0, y: 600, out: 0, xgrad0,ygrad600
I0422 06:32:43.320127 11020 kron_grad_kernel_impl.h:273] dims info - x: 0, 10, y: 5, 5, 4, 3, 2, out: 5, 5, 4, 0, 20, xgrad0, 10,ygrad5, 5, 4, 3, 2