Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
0a837cb2
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2298
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
0a837cb2
编写于
12月 27, 2022
作者:
姜
姜永久
提交者:
GitHub
12月 27, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rm _in_legacy part3 (#49264)
上级
140d786d
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
53 addition
and
147 deletion
+53
-147
python/paddle/fft.py
python/paddle/fft.py
+2
-62
python/paddle/incubate/operators/graph_send_recv.py
python/paddle/incubate/operators/graph_send_recv.py
+2
-15
python/paddle/incubate/tensor/manipulation.py
python/paddle/incubate/tensor/manipulation.py
+30
-33
python/paddle/incubate/tensor/math.py
python/paddle/incubate/tensor/math.py
+17
-22
python/paddle/signal.py
python/paddle/signal.py
+2
-15
未找到文件。
python/paddle/fft.py
浏览文件 @
0a837cb2
...
...
@@ -18,9 +18,9 @@ import numpy as np
import
paddle
from
.
import
_C_ops
,
_legacy_C_ops
from
.
import
_C_ops
from
.fluid.data_feeder
import
check_variable_and_dtype
from
.fluid.framework
import
_in_legacy_dygraph
,
in_dygraph_mode
from
.fluid.framework
import
in_dygraph_mode
from
.fluid.layer_helper
import
LayerHelper
from
.tensor.attribute
import
is_floating_point
,
is_integer
from
.tensor.creation
import
_complex_to_real_dtype
,
_real_to_complex_dtype
...
...
@@ -1445,9 +1445,6 @@ def fft_c2c(x, n, axis, norm, forward, name):
check_variable_and_dtype
(
x
,
'x'
,
[
'complex64'
,
'complex128'
],
op_type
)
if
in_dygraph_mode
():
out
=
_C_ops
.
fft_c2c
(
x
,
axes
,
norm
,
forward
)
elif
_in_legacy_dygraph
():
attrs
=
(
'axes'
,
axes
,
'normalization'
,
norm
,
'forward'
,
forward
)
out
=
getattr
(
_legacy_C_ops
,
op_type
)(
x
,
*
attrs
)
else
:
inputs
=
{
'X'
:
[
x
],
...
...
@@ -1480,18 +1477,6 @@ def fft_r2c(x, n, axis, norm, forward, onesided, name):
if
in_dygraph_mode
():
out
=
_C_ops
.
fft_r2c
(
x
,
axes
,
norm
,
forward
,
onesided
)
elif
_in_legacy_dygraph
():
attrs
=
(
'axes'
,
axes
,
'normalization'
,
norm
,
'forward'
,
forward
,
'onesided'
,
onesided
,
)
out
=
getattr
(
_legacy_C_ops
,
op_type
)(
x
,
*
attrs
)
else
:
inputs
=
{
'X'
:
[
x
],
...
...
@@ -1536,21 +1521,6 @@ def fft_c2r(x, n, axis, norm, forward, name):
out
=
_C_ops
.
fft_c2r
(
x
,
axes
,
norm
,
forward
,
n
)
else
:
out
=
_C_ops
.
fft_c2r
(
x
,
axes
,
norm
,
forward
,
0
)
elif
_in_legacy_dygraph
():
if
n
is
not
None
:
attrs
=
(
'axes'
,
axes
,
'normalization'
,
norm
,
'forward'
,
forward
,
'last_dim_size'
,
n
,
)
else
:
attrs
=
(
'axes'
,
axes
,
'normalization'
,
norm
,
'forward'
,
forward
)
out
=
getattr
(
_legacy_C_ops
,
op_type
)(
x
,
*
attrs
)
else
:
inputs
=
{
'X'
:
[
x
],
...
...
@@ -1607,9 +1577,6 @@ def fftn_c2c(x, s, axes, norm, forward, name):
if
in_dygraph_mode
():
out
=
_C_ops
.
fft_c2c
(
x
,
axes
,
norm
,
forward
)
elif
_in_legacy_dygraph
():
attrs
=
(
'axes'
,
axes
,
'normalization'
,
norm
,
'forward'
,
forward
)
out
=
getattr
(
_legacy_C_ops
,
op_type
)(
x
,
*
attrs
)
else
:
inputs
=
{
'X'
:
[
x
],
...
...
@@ -1661,18 +1628,6 @@ def fftn_r2c(x, s, axes, norm, forward, onesided, name):
if
in_dygraph_mode
():
out
=
_C_ops
.
fft_r2c
(
x
,
axes
,
norm
,
forward
,
onesided
)
elif
_in_legacy_dygraph
():
attrs
=
(
'axes'
,
axes
,
'normalization'
,
norm
,
'forward'
,
forward
,
'onesided'
,
onesided
,
)
out
=
getattr
(
_legacy_C_ops
,
op_type
)(
x
,
*
attrs
)
else
:
inputs
=
{
'X'
:
[
x
],
...
...
@@ -1739,21 +1694,6 @@ def fftn_c2r(x, s, axes, norm, forward, name):
out
=
_C_ops
.
fft_c2r
(
x
,
axes
,
norm
,
forward
,
s
[
-
1
])
else
:
out
=
_C_ops
.
fft_c2r
(
x
,
axes
,
norm
,
forward
,
0
)
elif
_in_legacy_dygraph
():
if
s
:
attrs
=
(
'axes'
,
axes
,
'normalization'
,
norm
,
'forward'
,
forward
,
'last_dim_size'
,
s
[
-
1
],
)
else
:
attrs
=
(
'axes'
,
axes
,
'normalization'
,
norm
,
'forward'
,
forward
)
out
=
getattr
(
_legacy_C_ops
,
op_type
)(
x
,
*
attrs
)
else
:
inputs
=
{
'X'
:
[
x
],
...
...
python/paddle/incubate/operators/graph_send_recv.py
浏览文件 @
0a837cb2
...
...
@@ -15,14 +15,14 @@
import
numpy
as
np
import
paddle.utils.deprecated
as
deprecated
from
paddle
import
_C_ops
,
_legacy_C_ops
from
paddle
import
_C_ops
from
paddle.fluid.data_feeder
import
(
check_dtype
,
check_type
,
check_variable_and_dtype
,
convert_dtype
,
)
from
paddle.fluid.framework
import
Variable
,
_in_legacy_dygraph
,
in_dygraph_mode
from
paddle.fluid.framework
import
Variable
,
in_dygraph_mode
from
paddle.fluid.layer_helper
import
LayerHelper
from
paddle.fluid.layers.tensor
import
cast
...
...
@@ -124,19 +124,6 @@ def graph_send_recv(
# TODO(daisiming): Should we add judgement for out_size: max(dst_index) + 1.
if
_in_legacy_dygraph
():
out_size
=
convert_out_size_to_list
(
out_size
)
out
,
tmp
=
_legacy_C_ops
.
graph_send_recv
(
x
,
src_index
,
dst_index
,
None
,
'reduce_op'
,
pool_type
.
upper
(),
'out_size'
,
out_size
,
)
return
out
if
in_dygraph_mode
():
out_size
=
convert_out_size_to_list
(
out_size
)
return
_C_ops
.
send_u_recv
(
...
...
python/paddle/incubate/tensor/manipulation.py
浏览文件 @
0a837cb2
...
...
@@ -12,9 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from
paddle
import
_C_ops
,
_legacy_C_ops
from
paddle
import
_C_ops
from
paddle.fluid.data_feeder
import
check_variable_and_dtype
from
paddle.fluid.framework
import
_in_legacy_dygraph
,
in_dygraph_mode
from
paddle.fluid.framework
import
in_dygraph_mode
from
paddle.fluid.layer_helper
import
LayerHelper
__all__
=
[]
...
...
@@ -49,10 +49,7 @@ def _npu_identity(x, format=-1):
"""
if
in_dygraph_mode
():
return
_C_ops
.
npu_identity
(
x
,
format
)
if
_in_legacy_dygraph
():
return
_legacy_C_ops
.
npu_identity
(
x
,
'format'
,
format
)
else
:
check_variable_and_dtype
(
x
,
'x'
,
...
...
python/paddle/incubate/tensor/math.py
浏览文件 @
0a837cb2
...
...
@@ -15,7 +15,7 @@
import
paddle.utils.deprecated
as
deprecated
from
paddle
import
_C_ops
,
_legacy_C_ops
from
paddle.fluid.data_feeder
import
check_variable_and_dtype
from
paddle.fluid.framework
import
_in_legacy_dygraph
,
in_dygraph_mode
from
paddle.fluid.framework
import
in_dygraph_mode
from
paddle.fluid.layer_helper
import
LayerHelper
,
_non_static_mode
__all__
=
[]
...
...
@@ -65,12 +65,7 @@ def segment_sum(data, segment_ids, name=None):
"""
if
in_dygraph_mode
():
return
_C_ops
.
segment_pool
(
data
,
segment_ids
,
"SUM"
)[
0
]
if
_in_legacy_dygraph
():
out
,
tmp
=
_legacy_C_ops
.
segment_pool
(
data
,
segment_ids
,
'pooltype'
,
"SUM"
)
return
out
else
:
check_variable_and_dtype
(
data
,
"X"
,
(
"float32"
,
"float64"
,
"int32"
,
"int64"
),
"segment_pool"
)
...
...
python/paddle/signal.py
浏览文件 @
0a837cb2
...
...
@@ -14,7 +14,7 @@
import
paddle
from
paddle
import
_C_ops
,
_legacy_C_ops
from
paddle.fluid.framework
import
_in_legacy_dygraph
,
in_dygraph_mode
from
paddle.fluid.framework
import
in_dygraph_mode
from
.fft
import
fft_c2c
,
fft_c2r
,
fft_r2c
from
.fluid.data_feeder
import
check_variable_and_dtype
...
...
@@ -125,23 +125,10 @@ def frame(x, frame_length, hop_length, axis=-1, name=None):
f
'but got (
{
frame_length
}
) > (
{
x
.
shape
[
axis
]
}
).'
)
op_type
=
'frame'
if
in_dygraph_mode
():
return
_C_ops
.
frame
(
x
,
frame_length
,
hop_length
,
axis
)
if
_in_legacy_dygraph
():
attrs
=
(
'frame_length'
,
frame_length
,
'hop_length'
,
hop_length
,
'axis'
,
axis
,
)
op
=
getattr
(
_legacy_C_ops
,
op_type
)
out
=
op
(
x
,
*
attrs
)
else
:
op_type
=
'frame'
check_variable_and_dtype
(
x
,
'x'
,
[
'int32'
,
'int64'
,
'float16'
,
'float32'
,
'float64'
],
op_type
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录