Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Crayon鑫
Paddle
提交
c29aa8c4
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看板
未验证
提交
c29aa8c4
编写于
9月 28, 2020
作者:
M
mapingshuo
提交者:
GitHub
9月 28, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix reshape doc, remove reverse api (#27592)
上级
1539a238
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
10 addition
and
20 deletion
+10
-20
python/paddle/tensor/manipulation.py
python/paddle/tensor/manipulation.py
+10
-20
未找到文件。
python/paddle/tensor/manipulation.py
浏览文件 @
c29aa8c4
...
@@ -175,9 +175,6 @@ def flip(x, axis, name=None):
...
@@ -175,9 +175,6 @@ def flip(x, axis, name=None):
return
out
return
out
reverse
=
flip
#DEFINE_ALIAS
def
flatten
(
x
,
start_axis
=
0
,
stop_axis
=-
1
,
name
=
None
):
def
flatten
(
x
,
start_axis
=
0
,
stop_axis
=-
1
,
name
=
None
):
"""
"""
**Flatten op**
**Flatten op**
...
@@ -1258,9 +1255,6 @@ broadcast_to = expand
...
@@ -1258,9 +1255,6 @@ broadcast_to = expand
def
reshape
(
x
,
shape
,
name
=
None
):
def
reshape
(
x
,
shape
,
name
=
None
):
"""
"""
:alias_main: paddle.reshape
:alias: paddle.reshape,paddle.tensor.reshape,paddle.tensor.manipulation.reshape
This operator changes the shape of ``x`` without changing its data.
This operator changes the shape of ``x`` without changing its data.
Some tricks exist when specifying the target shape.
Some tricks exist when specifying the target shape.
...
@@ -1309,22 +1303,18 @@ def reshape(x, shape, name=None):
...
@@ -1309,22 +1303,18 @@ def reshape(x, shape, name=None):
import numpy as np
import numpy as np
import paddle
import paddle
paddle.disable_static()
x = paddle.rand([2, 4, 6], dtype="float32")
positive_four = paddle.full([1], 4, "int32")
data = np.random.random([2, 4, 6]).astype("float32")
out = paddle.reshape(x, [-1, 0, 3, 2])
x = paddle.to_tensor(data)
print(out)
# the shape is [2,4,3,2].
positive_four = paddle.fill_constant([1], "int32", 4)
out = paddle.reshape(x, shape=[positive_four, 12])
print(out)
out_1 = paddle.reshape(x, [-1, 0, 3, 2])
# the shape of out_1 is [2,4,3,2].
out_2 = paddle.reshape(x, shape=[positive_four, 12])
# the shape of out_2 is [4, 12].
# the shape of out_2 is [4, 12].
shape_tensor = paddle.to_tensor(np.array([8, 6]).astype("int32"))
shape_tensor = paddle.to_tensor(np.array([8, 6]).astype("int32"))
out_3 = paddle.reshape(x, shape=shape_tensor)
out = paddle.reshape(x, shape=shape_tensor)
# the shape of out_2 is [8, 6].
print(out)
# the shape is [8, 6].
"""
"""
return
paddle
.
fluid
.
layers
.
reshape
(
x
=
x
,
shape
=
shape
,
name
=
name
)
return
paddle
.
fluid
.
layers
.
reshape
(
x
=
x
,
shape
=
shape
,
name
=
name
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录