Skip to content

Commit 35d61ff

Browse files
authored
Update new python api (#5102)
* update doc of new python api * fix some doc * update * update dygraph mode * modify with review
1 parent 2b2d048 commit 35d61ff

File tree

4 files changed

+167
-174
lines changed

4 files changed

+167
-174
lines changed
-36 KB
Loading
188 KB
Loading

docs/dev_guides/api_contributing_guides/new_cpp_op_cn.md

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -773,13 +773,7 @@ def trace(x, offset=0, axis1=0, axis2=1, name=None):
773773
if in_dygraph_mode():
774774
return _C_ops.final_state_trace( x, offset, axis1, axis2 )
775775

776-
if _in_legacy_dygraph():
777-
return _C_ops.trace(x, 'offset', offset, 'axis1', axis1, 'axis2', axis2)
778-
779-
inputs = {'Input': [x]}
780-
attrs = {'offset': offset, 'axis1': axis1, 'axis2': axis2}
781776
helper = LayerHelper('trace', **locals())
782-
783777
out = helper.create_variable_for_type_inference(dtype=x.dtype)
784778

785779
helper.append_op(
@@ -794,8 +788,8 @@ def trace(x, offset=0, axis1=0, axis2=1, name=None):
794788

795789
- Python API 实现要点(详见[飞桨API Python 端开发指南](./new_python_api_cn.html)
796790
- 对输入参数进行合法性检查,即 `__check_input(input, offset, axis1, axis2)`
797-
- 添加动态图分支调用,即 `if in_dygraph_mode` 新动态图分支和 `if _in_legacy_dygraph` 旧动态图分支
798-
- 添加静态图分支调用,即dygraph分支后剩余的代码
791+
- 添加动态图分支调用,即 `if in_dygraph_mode` 进入动态图调用分支
792+
- 添加静态图分支调用,即动态图分支后剩余的代码
799793

800794

801795
## 5. 添加单元测试

0 commit comments

Comments
 (0)