Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Crayon鑫
Paddle
提交
546b1c1d
P
Paddle
项目概览
Crayon鑫
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
546b1c1d
编写于
11月 10, 2020
作者:
H
Huihuang Zheng
提交者:
GitHub
11月 10, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix paddle.jit.dy2static.data_layer_not_check 2.0 API Doc (#28461)
Remove "fluid", "variable" in 2.0 API doc
上级
8f664a5c
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
11 addition
and
10 deletion
+11
-10
python/paddle/fluid/dygraph/dygraph_to_static/variable_trans_func.py
...le/fluid/dygraph/dygraph_to_static/variable_trans_func.py
+11
-10
未找到文件。
python/paddle/fluid/dygraph/dygraph_to_static/variable_trans_func.py
浏览文件 @
546b1c1d
...
@@ -29,19 +29,19 @@ __all__ = [
...
@@ -29,19 +29,19 @@ __all__ = [
def
data_layer_not_check
(
name
,
shape
,
dtype
=
'float32'
,
lod_level
=
0
):
def
data_layer_not_check
(
name
,
shape
,
dtype
=
'float32'
,
lod_level
=
0
):
"""
"""
This function creates a
variable on the global block. Unlike
This function creates a
Tensor on the global block. The created Tensor
`paddle.fluid.data` , the created variable doesn't check the dtype and the
doesn't check the dtype and the shape of feed data because dygraph input
shape of feed data because dygraph input data can be variable-length.
data can be various-length. This API is used in translating dygraph into
This API is used in translating dygraph into
static graph.
static graph.
Note:
Note:
The default :code:`stop_gradient` attribute of the
Variable
created by
The default :code:`stop_gradient` attribute of the
Tensor
created by
this API is true, which means the gradient won't be passed backward
this API is true, which means the gradient won't be passed backward
through the data
Varaible
. Set :code:`var.stop_gradient = False` If
through the data
Tensor
. Set :code:`var.stop_gradient = False` If
user would like to pass backward gradient.
user would like to pass backward gradient.
Args:
Args:
name (str): The name/alias of the
variable
, see :ref:`api_guide_Name`
name (str): The name/alias of the
Tensor
, see :ref:`api_guide_Name`
for more details.
for more details.
shape (list|tuple): List|Tuple of integers declaring the shape. You can
shape (list|tuple): List|Tuple of integers declaring the shape. You can
set "None" at a dimension to indicate the dimension can be of any
set "None" at a dimension to indicate the dimension can be of any
...
@@ -54,7 +54,7 @@ def data_layer_not_check(name, shape, dtype='float32', lod_level=0):
...
@@ -54,7 +54,7 @@ def data_layer_not_check(name, shape, dtype='float32', lod_level=0):
use LoD level, see :ref:`user_guide_lod_tensor` . Default: 0
use LoD level, see :ref:`user_guide_lod_tensor` . Default: 0
Returns:
Returns:
Variable: The global variable
that gives access to the data.
Tensor: The global Tensor
that gives access to the data.
"""
"""
helper
=
LayerHelper
(
'data'
,
**
locals
())
helper
=
LayerHelper
(
'data'
,
**
locals
())
shape
=
list
(
shape
)
shape
=
list
(
shape
)
...
@@ -87,7 +87,8 @@ def create_static_variable_gast_node(name):
...
@@ -87,7 +87,8 @@ def create_static_variable_gast_node(name):
def
create_fill_constant_node
(
name
,
value
):
def
create_fill_constant_node
(
name
,
value
):
func_code
=
"{} = paddle.fluid.layers.fill_constant(shape=[1], "
.
format
(
name
)
func_code
=
"{} = paddle.fluid.layers.fill_constant(shape=[1], "
.
format
(
name
)
if
isinstance
(
value
,
bool
):
if
isinstance
(
value
,
bool
):
func_code
+=
"dtype='bool', value={})"
.
format
(
value
)
func_code
+=
"dtype='bool', value={})"
.
format
(
value
)
return
gast
.
parse
(
func_code
).
body
[
0
]
return
gast
.
parse
(
func_code
).
body
[
0
]
...
@@ -110,7 +111,7 @@ def create_fill_constant_node(name, value):
...
@@ -110,7 +111,7 @@ def create_fill_constant_node(name, value):
def
to_static_variable
(
x
):
def
to_static_variable
(
x
):
'''
'''
Translate a Python
variable to PaddlePaddle static graph variable
Translate a Python
Tensor to PaddlePaddle static graph Tensor
'''
'''
if
isinstance
(
x
,
bool
):
if
isinstance
(
x
,
bool
):
return
fill_constant
(
shape
=
[
1
],
dtype
=
'bool'
,
value
=
x
)
return
fill_constant
(
shape
=
[
1
],
dtype
=
'bool'
,
value
=
x
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录