-
Notifications
You must be signed in to change notification settings - Fork 750
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
modify some cn doc #2710
modify some cn doc #2710
Changes from all commits
36a98db
84413da
1a02835
62ed3bd
ee5b6c0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
paddle.utils | ||
paddle.incubate | ||
paddle.hapi.progressbar.ProgressBar | ||
paddle.fluid.contrib | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
generate | ||
------------------------------- | ||
|
||
.. py:function:: paddle.fluid.unique_name.generate(key) | ||
.. py:function:: paddle.utils.unique_name.generate(key) | ||
|
||
|
||
|
||
|
@@ -13,17 +13,14 @@ generate | |
参数: | ||
- **key** (str) - 产生的唯一名称的前缀。 | ||
|
||
返回:含前缀key的唯一名称。 | ||
|
||
返回类型:str。 | ||
返回:str, 含前缀key的唯一名称。 | ||
|
||
**代码示例** | ||
|
||
.. code-block:: python | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 返回类型同上 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done,thx! |
||
|
||
import paddle.fluid as fluid | ||
name1 = fluid.unique_name.generate('fc') | ||
name2 = fluid.unique_name.generate('fc') | ||
print(name1, name2) # fc_0, fc_1 | ||
|
||
import paddle | ||
name1 = paddle.utils.unique_name.generate('fc') | ||
name2 = paddle.utils.unique_name.generate('fc') | ||
print(name1, name2) # fc_0, fc_1 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
switch | ||
------------------------------- | ||
|
||
.. py:function:: paddle.fluid.unique_name.switch(new_generator=None) | ||
.. py:function:: paddle.utils.unique_name.switch(new_generator=None) | ||
|
||
|
||
|
||
|
@@ -13,23 +13,21 @@ switch | |
参数: | ||
- **new_generator** (UniqueNameGenerator, 可选) - 要切换到的新命名空间,一般无需设置。缺省值为None,表示切换到一个匿名的新命名空间。 | ||
|
||
返回:先前的命名空间,一般无需操作该返回值。 | ||
|
||
返回类型:UniqueNameGenerator。 | ||
返回:UniqueNameGenerator, 先前的命名空间,一般无需操作该返回值。 | ||
|
||
**代码示例** | ||
|
||
.. code-block:: python | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 返回类型同上 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done,thx! |
||
|
||
import paddle.fluid as fluid | ||
name1 = fluid.unique_name.generate('fc') | ||
name2 = fluid.unique_name.generate('fc') | ||
print(name1, name2) # fc_0, fc_1 | ||
pre_generator = fluid.unique_name.switch() # 切换到新命名空间 | ||
name2 = fluid.unique_name.generate('fc') | ||
print(name2) # fc_0 | ||
|
||
fluid.unique_name.switch(pre_generator) # 切换回原命名空间 | ||
name3 = fluid.unique_name.generate('fc') | ||
print(name3) # fc_2, 因为原命名空间已生成fc_0, fc_1 | ||
import paddle | ||
name1 = paddle.utils.unique_name.generate('fc') | ||
name2 = paddle.utils.unique_name.generate('fc') | ||
print(name1, name2) # fc_0, fc_1 | ||
|
||
pre_generator, pre_dygraph_name_checker = paddle.utils.unique_name.switch() # switch to a new anonymous namespace. | ||
name2 = paddle.utils.unique_name.generate('fc') | ||
print(name2) # fc_0 | ||
|
||
paddle.utils.unique_name.switch(pre_generator, pre_dygraph_name_checker) # switch back to pre_generator. | ||
name3 = paddle.utils.unique_name.generate('fc') | ||
print(name3) # fc_2, since pre_generator has generated fc_0, fc_1. |
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.
返回类型 和 返回写在一起哈,如
【返回:Variable,一个xxx】
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.
done,thx!