Skip to content

Commit

Permalink
Fix doc: (1) use StaticFunction to replace old name StaticLayer; (2) …
Browse files Browse the repository at this point in the history
…Fix code indentation; (PaddlePaddle#3148)
  • Loading branch information
liym27 authored Jan 20, 2021
1 parent 8219685 commit af6c5b1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions doc/paddle/guides/04_dygraph_to_static/debugging_cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,12 @@ func(np.ones([3, 2]))
您可以打印转换后的静态图代码,有2种方法:
1. 使用被装饰后的函数的 `code` 属性
如下代码中,装饰器 `paddle.jit.to_static` 会将函数 `func` 转化为一个类对象 `StaticLayer`,可以使用 StaticLayer 的 `code` 属性来获得转化后的代码。
如下代码中,装饰器 `paddle.jit.to_static` 会将函数 `func` 转化为一个类对象 `StaticFunction`,可以使用 StaticFunction 的 `code` 属性来获得转化后的代码。
```Python
@paddle.jit.to_static
def func(x):
x = paddle.to_tensor(x)
x = paddle.to_tensor(x)
if x > 3:
x = x - 1
return x
Expand Down
4 changes: 2 additions & 2 deletions doc/paddle/guides/04_dygraph_to_static/debugging_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ There are two ways to print the transformed static graph code:
1. Use the attribute `code` of the decorated function
In the following code, the decorator `paddle.jit.to_static` transforms `func` into a class object `StaticLayer`. You can use the `code` attribute of `StaticLayer` to get the transformed code.
In the following code, the decorator `paddle.jit.to_static` transforms `func` into a class object `StaticFunction`. You can use the `code` attribute of `StaticFunction` to get the transformed code.
```Python
@paddle.jit.to_static
def func(x):
x = paddle.to_tensor(x)
x = paddle.to_tensor(x)
if x > 3:
x = x - 1
return x
Expand Down

0 comments on commit af6c5b1

Please sign in to comment.