Skip to content

Commit

Permalink
补充实现方案
Browse files Browse the repository at this point in the history
  • Loading branch information
Ainavo committed Jul 7, 2022
1 parent 9f1cf34 commit 61c505f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion rfcs/APIs/20220706_api_design_for_pairwise_distance.md
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ class API 中的具体实现:
- 通过 `_in_legacy_dygraph` 判断是否为旧动态图,如果是,则先通过调用 `_C_ops.elementwise_sub` 逐元素相减,然后则调用 `_C_ops.p_norm` 计算两组张量间的距离范数。
- 如果是静态图的话,首先实例化 `LayerHelper("PairwiseDistance", name=self.name)` ,然后调用 `paddle.subtract` 逐元素相减,调用`helper.append_op`加载参数, 调用`helper.create_variable_for_type_inference` 计算两组张量间的距离范数。

经测试,输入 x,y 的 shape 皆为(D, ),调用 `nn.PairwiseDistance` class API 进行计算时会报维度错误,因为调用 `_C_ops.p_norm``_C_ops.final_state_p_norm` 时,维度参数为 1。
经测试,输入 x,y 的 shape 皆为(D, ),调用 `nn.PairwiseDistance` class API 进行计算时会报维度错误,因为调用 `_C_ops.p_norm``_C_ops.final_state_p_norm` 时,维度参数为 1,将该参数更改为 -1 即可

# 六、测试和验收的考量

Expand Down

0 comments on commit 61c505f

Please sign in to comment.