Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
2f75465d
P
Paddle
项目概览
PaddlePaddle
/
Paddle
1 年多 前同步成功
通知
2302
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
2f75465d
编写于
8月 28, 2020
作者:
L
lilong12
提交者:
GitHub
8月 28, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix the call to core.ops.x, test=develop (#26729)
上级
f1ae017f
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
9 addition
and
10 deletion
+9
-10
python/paddle/tensor/manipulation.py
python/paddle/tensor/manipulation.py
+9
-10
未找到文件。
python/paddle/tensor/manipulation.py
浏览文件 @
2f75465d
...
@@ -23,7 +23,6 @@ from ..fluid.layers import utils
...
@@ -23,7 +23,6 @@ from ..fluid.layers import utils
import
numpy
as
np
import
numpy
as
np
# TODO: define functions to manipulate a tensor
# TODO: define functions to manipulate a tensor
from
..fluid.layers
import
cast
#DEFINE_ALIAS
from
..fluid.layers
import
cast
#DEFINE_ALIAS
from
..fluid.layers
import
expand_as
#DEFINE_ALIAS
from
..fluid.layers
import
slice
#DEFINE_ALIAS
from
..fluid.layers
import
slice
#DEFINE_ALIAS
from
..fluid.layers
import
strided_slice
#DEFINE_ALIAS
from
..fluid.layers
import
strided_slice
#DEFINE_ALIAS
from
..fluid.layers
import
transpose
#DEFINE_ALIAS
from
..fluid.layers
import
transpose
#DEFINE_ALIAS
...
@@ -1100,6 +1099,9 @@ def tile(x, repeat_times, name=None):
...
@@ -1100,6 +1099,9 @@ def tile(x, repeat_times, name=None):
np_out = out.numpy()
np_out = out.numpy()
# [[1, 2, 3], [1, 2, 3]]
# [[1, 2, 3], [1, 2, 3]]
"""
"""
if
in_dygraph_mode
():
return
core
.
ops
.
tile
(
x
,
'repeat_times'
,
repeat_times
)
check_variable_and_dtype
(
check_variable_and_dtype
(
x
,
'x'
,
[
'bool'
,
'float32'
,
'float64'
,
'int32'
,
'int64'
],
'tile'
)
x
,
'x'
,
[
'bool'
,
'float32'
,
'float64'
,
'int32'
,
'int64'
],
'tile'
)
check_type
(
repeat_times
,
'repeat_times'
,
(
list
,
tuple
,
Variable
),
'tile'
)
check_type
(
repeat_times
,
'repeat_times'
,
(
list
,
tuple
,
Variable
),
'tile'
)
...
@@ -1109,9 +1111,6 @@ def tile(x, repeat_times, name=None):
...
@@ -1109,9 +1111,6 @@ def tile(x, repeat_times, name=None):
"must set its stop_gradient to be True by "
"must set its stop_gradient to be True by "
"some_var.stop_gradient == True supporting some_var is the input."
)
"some_var.stop_gradient == True supporting some_var is the input."
)
if
in_dygraph_mode
():
return
core
.
ops
.
tile
(
x
,
'repeat_times'
,
repeat_times
)
helper
=
LayerHelper
(
'tile'
,
**
locals
())
helper
=
LayerHelper
(
'tile'
,
**
locals
())
inputs
=
{
"X"
:
[
x
]}
inputs
=
{
"X"
:
[
x
]}
...
@@ -1176,6 +1175,9 @@ def expand_as(x, y, name=None):
...
@@ -1176,6 +1175,9 @@ def expand_as(x, y, name=None):
np_out = out.numpy()
np_out = out.numpy()
# [[1, 2, 3], [1, 2, 3]]
# [[1, 2, 3], [1, 2, 3]]
"""
"""
if
in_dygraph_mode
():
return
core
.
ops
.
expand_as_v2
(
x
,
y
)
check_variable_and_dtype
(
check_variable_and_dtype
(
x
,
'x'
,
[
'bool'
,
'float32'
,
'float64'
,
'int32'
,
'int64'
],
'expand_as'
)
x
,
'x'
,
[
'bool'
,
'float32'
,
'float64'
,
'int32'
,
'int64'
],
'expand_as'
)
check_type
(
y
,
'y'
,
Variable
,
'expand_as'
)
check_type
(
y
,
'y'
,
Variable
,
'expand_as'
)
...
@@ -1188,9 +1190,6 @@ def expand_as(x, y, name=None):
...
@@ -1188,9 +1190,6 @@ def expand_as(x, y, name=None):
"some_var as the input 'x'."
)
"some_var as the input 'x'."
)
inputs
=
{
"X"
:
[
x
],
"target_tensor"
:
[
y
]}
inputs
=
{
"X"
:
[
x
],
"target_tensor"
:
[
y
]}
if
in_dygraph_mode
():
return
core
.
ops
.
expand_as_v2
(
x
,
y
)
helper
=
LayerHelper
(
'expand_as'
,
**
locals
())
helper
=
LayerHelper
(
'expand_as'
,
**
locals
())
dtype
=
helper
.
input_dtype
(
input_param_name
=
'x'
)
dtype
=
helper
.
input_dtype
(
input_param_name
=
'x'
)
out
=
helper
.
create_variable_for_type_inference
(
dtype
)
out
=
helper
.
create_variable_for_type_inference
(
dtype
)
...
@@ -1229,6 +1228,9 @@ def expand(x, shape, name=None):
...
@@ -1229,6 +1228,9 @@ def expand(x, shape, name=None):
out = out.numpy()
out = out.numpy()
# [[1, 2, 3], [1, 2, 3]]
# [[1, 2, 3], [1, 2, 3]]
"""
"""
if
in_dygraph_mode
():
return
core
.
ops
.
expand_v2
(
x
,
'shape'
,
shape
)
check_variable_and_dtype
(
check_variable_and_dtype
(
x
,
'x'
,
[
'bool'
,
'float32'
,
'float64'
,
'int32'
,
'int64'
],
'expand'
)
x
,
'x'
,
[
'bool'
,
'float32'
,
'float64'
,
'int32'
,
'int64'
],
'expand'
)
check_type
(
shape
,
'shape'
,
(
list
,
tuple
,
Variable
),
'expand'
)
check_type
(
shape
,
'shape'
,
(
list
,
tuple
,
Variable
),
'expand'
)
...
@@ -1241,9 +1243,6 @@ def expand(x, shape, name=None):
...
@@ -1241,9 +1243,6 @@ def expand(x, shape, name=None):
"some_var.stop_gradient = True, supporting "
"some_var.stop_gradient = True, supporting "
"some_var as the input."
)
"some_var as the input."
)
if
in_dygraph_mode
():
return
core
.
ops
.
expand_v2
(
x
,
'shape'
,
shape
)
helper
=
LayerHelper
(
'expand'
,
**
locals
())
helper
=
LayerHelper
(
'expand'
,
**
locals
())
def
get_attr_expand_shape
(
list_expand_shape
):
def
get_attr_expand_shape
(
list_expand_shape
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录