Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
bc01d56e
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看板
未验证
提交
bc01d56e
编写于
12月 01, 2022
作者:
N
Nyakku Shigure
提交者:
GitHub
12月 01, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[CodeStyle][isort] introduce isort (part6) (#48522)
上级
08c5f4c1
变更
71
隐藏空白更改
内联
并排
Showing
71 changed file
with
178 addition
and
212 deletion
+178
-212
pyproject.toml
pyproject.toml
+1
-8
python/paddle/distributed/passes/auto_parallel_data_parallel_optimization.py
...ibuted/passes/auto_parallel_data_parallel_optimization.py
+9
-8
python/paddle/distributed/passes/auto_parallel_grad_clip.py
python/paddle/distributed/passes/auto_parallel_grad_clip.py
+10
-9
python/paddle/distribution/normal.py
python/paddle/distribution/normal.py
+1
-4
python/paddle/distribution/uniform.py
python/paddle/distribution/uniform.py
+1
-6
python/paddle/fluid/tests/unittests/dygraph_to_static/bert_dygraph_model.py
...d/tests/unittests/dygraph_to_static/bert_dygraph_model.py
+1
-1
python/paddle/fluid/tests/unittests/dygraph_to_static/simnet_dygraph_model.py
...tests/unittests/dygraph_to_static/simnet_dygraph_model.py
+0
-3
python/paddle/fluid/tests/unittests/dygraph_to_static/test_convert_call.py
...id/tests/unittests/dygraph_to_static/test_convert_call.py
+4
-6
python/paddle/fluid/tests/unittests/dygraph_to_static/test_lac.py
...addle/fluid/tests/unittests/dygraph_to_static/test_lac.py
+1
-3
python/paddle/fluid/tests/unittests/dygraph_to_static/test_len.py
...addle/fluid/tests/unittests/dygraph_to_static/test_len.py
+1
-0
python/paddle/fluid/tests/unittests/dygraph_to_static/test_logical.py
...e/fluid/tests/unittests/dygraph_to_static/test_logical.py
+1
-4
python/paddle/fluid/tests/unittests/dygraph_to_static/test_loop.py
...ddle/fluid/tests/unittests/dygraph_to_static/test_loop.py
+5
-4
python/paddle/fluid/tests/unittests/dygraph_to_static/test_mnist.py
...dle/fluid/tests/unittests/dygraph_to_static/test_mnist.py
+1
-1
python/paddle/fluid/tests/unittests/dygraph_to_static/test_mobile_net.py
...luid/tests/unittests/dygraph_to_static/test_mobile_net.py
+2
-9
python/paddle/fluid/tests/unittests/dygraph_to_static/test_reinforcement_learning.py
...nittests/dygraph_to_static/test_reinforcement_learning.py
+1
-1
python/paddle/fluid/tests/unittests/dygraph_to_static/test_resnet.py
...le/fluid/tests/unittests/dygraph_to_static/test_resnet.py
+2
-4
python/paddle/fluid/tests/unittests/dygraph_to_static/test_save_inference_model.py
.../unittests/dygraph_to_static/test_save_inference_model.py
+3
-4
python/paddle/fluid/tests/unittests/dygraph_to_static/test_save_load.py
...fluid/tests/unittests/dygraph_to_static/test_save_load.py
+4
-4
python/paddle/fluid/tests/unittests/dygraph_to_static/test_se_resnet.py
...fluid/tests/unittests/dygraph_to_static/test_se_resnet.py
+2
-2
python/paddle/fluid/tests/unittests/dygraph_to_static/test_sentiment.py
...fluid/tests/unittests/dygraph_to_static/test_sentiment.py
+1
-2
python/paddle/fluid/tests/unittests/dygraph_to_static/test_seq2seq.py
...e/fluid/tests/unittests/dygraph_to_static/test_seq2seq.py
+3
-4
python/paddle/fluid/tests/unittests/dygraph_to_static/test_tsm.py
...addle/fluid/tests/unittests/dygraph_to_static/test_tsm.py
+3
-4
python/paddle/fluid/tests/unittests/dygraph_to_static/test_word2vec.py
.../fluid/tests/unittests/dygraph_to_static/test_word2vec.py
+3
-4
python/paddle/fluid/tests/unittests/dygraph_to_static/transformer_dygraph_model.py
.../unittests/dygraph_to_static/transformer_dygraph_model.py
+2
-7
python/paddle/fluid/tests/unittests/test_add_position_encoding_op.py
...le/fluid/tests/unittests/test_add_position_encoding_op.py
+2
-1
python/paddle/fluid/tests/unittests/test_affine_channel_op.py
...on/paddle/fluid/tests/unittests/test_affine_channel_op.py
+1
-0
python/paddle/fluid/tests/unittests/test_data_norm_op.py
python/paddle/fluid/tests/unittests/test_data_norm_op.py
+5
-3
python/paddle/fluid/tests/unittests/test_detach.py
python/paddle/fluid/tests/unittests/test_detach.py
+1
-1
python/paddle/fluid/tests/unittests/test_dygraph_mnist_fp16.py
...n/paddle/fluid/tests/unittests/test_dygraph_mnist_fp16.py
+1
-1
python/paddle/fluid/tests/unittests/test_dygraph_multi_forward.py
...addle/fluid/tests/unittests/test_dygraph_multi_forward.py
+1
-1
python/paddle/fluid/tests/unittests/test_executor_return_tensor_not_overwriting.py
.../unittests/test_executor_return_tensor_not_overwriting.py
+2
-1
python/paddle/fluid/tests/unittests/test_fill_zeros_like2_op.py
.../paddle/fluid/tests/unittests/test_fill_zeros_like2_op.py
+1
-0
python/paddle/fluid/tests/unittests/test_fuse_elewise_add_act_pass.py
...e/fluid/tests/unittests/test_fuse_elewise_add_act_pass.py
+2
-1
python/paddle/fluid/tests/unittests/test_group_norm_op.py
python/paddle/fluid/tests/unittests/test_group_norm_op.py
+4
-3
python/paddle/fluid/tests/unittests/test_imperative_basic.py
python/paddle/fluid/tests/unittests/test_imperative_basic.py
+1
-1
python/paddle/fluid/tests/unittests/test_imperative_container_sequential.py
...d/tests/unittests/test_imperative_container_sequential.py
+1
-1
python/paddle/fluid/tests/unittests/test_imperative_deepcf.py
...on/paddle/fluid/tests/unittests/test_imperative_deepcf.py
+1
-1
python/paddle/fluid/tests/unittests/test_imperative_framework.py
...paddle/fluid/tests/unittests/test_imperative_framework.py
+0
-1
python/paddle/fluid/tests/unittests/test_imperative_gan.py
python/paddle/fluid/tests/unittests/test_imperative_gan.py
+1
-1
python/paddle/fluid/tests/unittests/test_imperative_layer_trainable.py
.../fluid/tests/unittests/test_imperative_layer_trainable.py
+1
-1
python/paddle/fluid/tests/unittests/test_imperative_load_static_param.py
...luid/tests/unittests/test_imperative_load_static_param.py
+0
-4
python/paddle/fluid/tests/unittests/test_imperative_mnist.py
python/paddle/fluid/tests/unittests/test_imperative_mnist.py
+2
-3
python/paddle/fluid/tests/unittests/test_imperative_ocr_attention_model.py
...id/tests/unittests/test_imperative_ocr_attention_model.py
+2
-7
python/paddle/fluid/tests/unittests/test_imperative_optimizer.py
...paddle/fluid/tests/unittests/test_imperative_optimizer.py
+3
-4
python/paddle/fluid/tests/unittests/test_imperative_optimizer_v2.py
...dle/fluid/tests/unittests/test_imperative_optimizer_v2.py
+3
-4
python/paddle/fluid/tests/unittests/test_imperative_partitial_backward.py
...uid/tests/unittests/test_imperative_partitial_backward.py
+1
-1
python/paddle/fluid/tests/unittests/test_imperative_reinforcement.py
...le/fluid/tests/unittests/test_imperative_reinforcement.py
+1
-1
python/paddle/fluid/tests/unittests/test_imperative_resnet.py
...on/paddle/fluid/tests/unittests/test_imperative_resnet.py
+1
-2
python/paddle/fluid/tests/unittests/test_imperative_se_resnext.py
...addle/fluid/tests/unittests/test_imperative_se_resnext.py
+0
-1
python/paddle/fluid/tests/unittests/test_imperative_trace_non_persistable_inputs.py
...unittests/test_imperative_trace_non_persistable_inputs.py
+1
-1
python/paddle/fluid/tests/unittests/test_imperative_transformer_sorted_gradient.py
.../unittests/test_imperative_transformer_sorted_gradient.py
+4
-7
python/paddle/fluid/tests/unittests/test_isfinite_op.py
python/paddle/fluid/tests/unittests/test_isfinite_op.py
+1
-0
python/paddle/fluid/tests/unittests/test_jit_save_load.py
python/paddle/fluid/tests/unittests/test_jit_save_load.py
+1
-1
python/paddle/fluid/tests/unittests/test_learning_rate_scheduler.py
...dle/fluid/tests/unittests/test_learning_rate_scheduler.py
+5
-3
python/paddle/fluid/tests/unittests/test_multiprocess_dataloader_dynamic.py
...d/tests/unittests/test_multiprocess_dataloader_dynamic.py
+2
-3
python/paddle/fluid/tests/unittests/test_multiprocess_dataloader_iterable_dataset_dynamic.py
.../test_multiprocess_dataloader_iterable_dataset_dynamic.py
+2
-4
python/paddle/fluid/tests/unittests/test_ones_op.py
python/paddle/fluid/tests/unittests/test_ones_op.py
+0
-1
python/paddle/fluid/tests/unittests/test_paddle_save_load.py
python/paddle/fluid/tests/unittests/test_paddle_save_load.py
+7
-6
python/paddle/fluid/tests/unittests/test_pool3d_op.py
python/paddle/fluid/tests/unittests/test_pool3d_op.py
+2
-1
python/paddle/fluid/tests/unittests/test_roi_pool_op.py
python/paddle/fluid/tests/unittests/test_roi_pool_op.py
+5
-4
python/paddle/fluid/tests/unittests/test_sigmoid_cross_entropy_with_logits_op.py
...ts/unittests/test_sigmoid_cross_entropy_with_logits_op.py
+6
-5
python/paddle/fluid/tests/unittests/test_similarity_focus_op.py
.../paddle/fluid/tests/unittests/test_similarity_focus_op.py
+1
-0
python/paddle/fluid/tests/unittests/test_size_op.py
python/paddle/fluid/tests/unittests/test_size_op.py
+3
-2
python/paddle/fluid/tests/unittests/test_static_save_load.py
python/paddle/fluid/tests/unittests/test_static_save_load.py
+8
-6
python/paddle/fluid/tests/unittests/utils.py
python/paddle/fluid/tests/unittests/utils.py
+3
-2
python/paddle/fluid/tests/unittests/xpu/test_affine_channel_op_xpu.py
...e/fluid/tests/unittests/xpu/test_affine_channel_op_xpu.py
+2
-0
python/paddle/hapi/progressbar.py
python/paddle/hapi/progressbar.py
+2
-1
python/paddle/incubate/multiprocessing/reductions.py
python/paddle/incubate/multiprocessing/reductions.py
+4
-4
python/paddle/inference/wrapper.py
python/paddle/inference/wrapper.py
+12
-6
python/paddle/static/nn/common.py
python/paddle/static/nn/common.py
+6
-8
python/paddle/vision/datasets/folder.py
python/paddle/vision/datasets/folder.py
+1
-0
未找到文件。
pyproject.toml
浏览文件 @
bc01d56e
...
...
@@ -19,13 +19,6 @@ extend_skip_glob = [
"python/paddle/fluid/tests/unittests/mlu/**"
,
# These files will be fixed in the future
"cmake/**"
,
"paddle/**"
,
"r/**"
,
"tools/**"
,
"python/paddle/[!f]**"
,
"python/paddle/fluid/tests/unittests/[t-z]**"
,
"python/paddle/fluid/tests/unittests/dygraph_to_static/test_error.py"
,
"python/paddle/fluid/tests/unittests/dygraph_to_static/**"
,
"python/paddle/fluid/tests/unittests/ipu/test_dy2static_ipu.py"
,
"python/paddle/jit/**"
,
]
python/paddle/distributed/passes/auto_parallel_data_parallel_optimization.py
浏览文件 @
bc01d56e
...
...
@@ -15,24 +15,25 @@
from
collections
import
OrderedDict
import
paddle
from
paddle.fluid
import
unique_name
from
paddle.fluid.framework
import
default_main_program
from
paddle.distributed.fleet.meta_optimizers.common
import
OP_ROLE_KEY
,
OpRole
from
.pass_base
import
PassBase
,
PassType
,
register_pass
from
paddle.distributed.auto_parallel.operators.common
import
(
is_data_parallel_scale_op
,
is_data_parallel_reduce_op
,
is_data_parallel_scale_op
,
)
from
paddle.distributed.auto_parallel.utils
import
(
find_higher_order_backward_op
,
get_var_numel
,
insert_dependencies_for_two_vars
,
is_forward_op
,
is_loss_grad_op
,
is_optimize_op
,
is_forward_op
,
ring_id_to_process_group
,
get_var_numel
,
use_standalone_executor
,
insert_dependencies_for_two_vars
,
)
from
paddle.distributed.fleet.meta_optimizers.common
import
OP_ROLE_KEY
,
OpRole
from
paddle.fluid
import
unique_name
from
paddle.fluid.framework
import
default_main_program
from
.pass_base
import
PassBase
,
PassType
,
register_pass
# add new optimizers supporting rescale_grad here
__rescale_grad_supported_opts__
=
[
...
...
python/paddle/distributed/passes/auto_parallel_grad_clip.py
浏览文件 @
bc01d56e
...
...
@@ -12,27 +12,28 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import
numpy
as
np
from
functools
import
reduce
import
numpy
as
np
import
paddle
from
.pass_base
import
PassBase
,
register_pass
from
..auto_parallel.reshard
import
Resharder
from
..auto_parallel.dist_attribute
import
(
OperatorDistributedAttribute
,
TensorDistributedAttribute
,
)
from
..auto_parallel.process_group
import
get_world_process_group
from
..auto_parallel.reshard
import
Resharder
from
..auto_parallel.utils
import
(
is_gradient_clip_op
,
is_optimize_op
,
OP_ROLE_KEY
,
OpRole
,
_get_comm_group
,
insert_dependencies_for_two_vars
,
is_gradient_clip_op
,
is_optimize_op
,
use_standalone_executor
,
)
from
..auto_parallel.dist_attribute
import
(
TensorDistributedAttribute
,
OperatorDistributedAttribute
,
)
from
.pass_base
import
PassBase
,
register_pass
def
_get_params_grads
(
block
):
...
...
python/paddle/distribution/normal.py
浏览文件 @
bc01d56e
...
...
@@ -21,10 +21,7 @@ import paddle
from
paddle.distribution
import
distribution
from
paddle.fluid.data_feeder
import
check_type
,
convert_dtype
from
paddle.fluid.framework
import
_non_static_mode
from
paddle.fluid.layers
import
(
nn
,
tensor
,
)
from
paddle.fluid.layers
import
nn
,
tensor
class
Normal
(
distribution
.
Distribution
):
...
...
python/paddle/distribution/uniform.py
浏览文件 @
bc01d56e
...
...
@@ -23,12 +23,7 @@ from paddle.fluid.framework import (
_non_static_mode
,
in_dygraph_mode
,
)
from
paddle.fluid.layers
import
(
nn
,
tensor
,
)
import
paddle
from
paddle.fluid.layers
import
nn
,
tensor
from
paddle.tensor
import
random
...
...
python/paddle/fluid/tests/unittests/dygraph_to_static/bert_dygraph_model.py
浏览文件 @
bc01d56e
...
...
@@ -17,8 +17,8 @@ from transformer_dygraph_model import MultiHeadAttention, PrePostProcessLayer
import
paddle
import
paddle.fluid
as
fluid
from
paddle.fluid.dygraph
import
Embedding
,
Layer
from
paddle.nn
import
Linear
from
paddle.jit.api
import
declarative
from
paddle.nn
import
Linear
class
PositionwiseFeedForwardLayer
(
Layer
):
...
...
python/paddle/fluid/tests/unittests/dygraph_to_static/simnet_dygraph_model.py
浏览文件 @
bc01d56e
...
...
@@ -17,9 +17,6 @@ from functools import reduce
import
paddle
import
paddle.fluid
as
fluid
import
paddle.fluid.param_attr
as
attr
from
functools
import
reduce
from
paddle.fluid.dygraph
import
Embedding
,
Layer
from
paddle.jit.api
import
declarative
from
paddle.static
import
Variable
...
...
python/paddle/fluid/tests/unittests/dygraph_to_static/test_convert_call.py
浏览文件 @
bc01d56e
...
...
@@ -12,19 +12,17 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import
logging
import
unittest
import
logging
import
numpy
as
np
from
test_program_translator
import
get_source_code
import
paddle
import
paddle.fluid
as
fluid
from
paddle.jit
import
ProgramTranslator
from
paddle.jit.dy2static.convert_call_func
import
(
CONVERSION_OPTIONS
,
)
from
test_program_translator
import
get_source_code
import
paddle.jit.dy2static
as
_jst
from
paddle.jit
import
ProgramTranslator
from
paddle.jit.dy2static.convert_call_func
import
CONVERSION_OPTIONS
program_translator
=
ProgramTranslator
()
...
...
python/paddle/fluid/tests/unittests/dygraph_to_static/test_lac.py
浏览文件 @
bc01d56e
...
...
@@ -24,10 +24,8 @@ os.environ["CUDA_VISIBLE_DEVICES"] = "2"
import
paddle
import
paddle.fluid
as
fluid
from
paddle.fluid.dygraph
import
to_variable
from
paddle.fluid.dygraph
import
Embedding
,
GRUUnit
from
paddle
import
_legacy_C_ops
from
paddle.fluid.dygraph
import
Embedding
,
GRUUnit
,
to_variable
from
paddle.fluid.dygraph.io
import
INFER_MODEL_SUFFIX
,
INFER_PARAMS_SUFFIX
from
paddle.fluid.framework
import
_non_static_mode
from
paddle.jit
import
ProgramTranslator
...
...
python/paddle/fluid/tests/unittests/dygraph_to_static/test_len.py
浏览文件 @
bc01d56e
...
...
@@ -15,6 +15,7 @@
import
unittest
import
numpy
as
np
import
paddle
import
paddle.fluid
as
fluid
from
paddle.jit.api
import
declarative
...
...
python/paddle/fluid/tests/unittests/dygraph_to_static/test_logical.py
浏览文件 @
bc01d56e
...
...
@@ -22,10 +22,7 @@ import numpy as np
import
paddle
import
paddle.fluid
as
fluid
from
paddle.jit
import
ProgramTranslator
from
paddle.jit.dy2static.logical_transformer
import
(
cmpop_node_to_str
,
)
from
paddle.jit
import
ProgramTranslator
from
paddle.jit.dy2static.logical_transformer
import
cmpop_node_to_str
from
paddle.utils
import
gast
program_translator
=
ProgramTranslator
()
...
...
python/paddle/fluid/tests/unittests/dygraph_to_static/test_loop.py
浏览文件 @
bc01d56e
...
...
@@ -12,15 +12,16 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from
paddle.utils
import
gast
import
inspect
import
unittest
import
numpy
as
np
import
paddle
import
paddle.fluid
as
fluid
import
unittest
from
paddle.jit.dy2static.loop_transformer
import
NameVisitor
from
paddle.jit.api
import
declarative
from
paddle.jit.dy2static.loop_transformer
import
NameVisitor
from
paddle.utils
import
gast
SEED
=
2020
np
.
random
.
seed
(
SEED
)
...
...
python/paddle/fluid/tests/unittests/dygraph_to_static/test_mnist.py
浏览文件 @
bc01d56e
...
...
@@ -23,11 +23,11 @@ from predictor_utils import PredictorTools
import
paddle
import
paddle.fluid
as
fluid
from
paddle.fluid.dygraph
import
to_variable
from
paddle.nn
import
Linear
from
paddle.fluid.dygraph.base
import
switch_to_static_graph
from
paddle.fluid.dygraph.io
import
INFER_MODEL_SUFFIX
,
INFER_PARAMS_SUFFIX
from
paddle.fluid.framework
import
_test_eager_guard
from
paddle.fluid.optimizer
import
AdamOptimizer
from
paddle.nn
import
Linear
SEED
=
2020
...
...
python/paddle/fluid/tests/unittests/dygraph_to_static/test_mobile_net.py
浏览文件 @
bc01d56e
...
...
@@ -26,16 +26,9 @@ from paddle.fluid.dygraph.io import INFER_MODEL_SUFFIX, INFER_PARAMS_SUFFIX
from
paddle.fluid.dygraph.nn
import
BatchNorm
,
Linear
from
paddle.fluid.initializer
import
MSRA
from
paddle.fluid.param_attr
import
ParamAttr
from
paddle.fluid.dygraph.nn
import
BatchNorm
from
paddle.nn
import
Linear
from
paddle.jit.api
import
declarative
from
paddle.jit
import
ProgramTranslator
from
paddle.fluid.dygraph.io
import
INFER_MODEL_SUFFIX
,
INFER_PARAMS_SUFFIX
import
unittest
from
predictor_utils
import
PredictorTools
from
paddle.jit.api
import
declarative
from
paddle.nn
import
Linear
# Note: Set True to eliminate randomness.
# 1. For one operation, cuDNN has several algorithms,
...
...
python/paddle/fluid/tests/unittests/dygraph_to_static/test_reinforcement_learning.py
浏览文件 @
bc01d56e
...
...
@@ -21,7 +21,7 @@ import numpy as np
import
paddle
import
paddle.fluid
as
fluid
from
paddle.fluid.dygraph
import
to_variable
,
Layer
from
paddle.fluid.dygraph
import
Layer
,
to_variable
from
paddle.jit
import
ProgramTranslator
from
paddle.jit.api
import
declarative
...
...
python/paddle/fluid/tests/unittests/dygraph_to_static/test_resnet.py
浏览文件 @
bc01d56e
...
...
@@ -17,16 +17,14 @@ import os
import
tempfile
import
time
import
unittest
import
paddle
import
numpy
as
np
from
predictor_utils
import
PredictorTools
import
paddle
import
paddle.fluid
as
fluid
from
paddle.fluid.dygraph.nn
import
BatchNorm
from
paddle.jit
import
ProgramTranslator
from
paddle.fluid.dygraph.io
import
INFER_MODEL_SUFFIX
,
INFER_PARAMS_SUFFIX
from
paddle.fluid.dygraph.nn
import
BatchNorm
from
paddle.jit
import
ProgramTranslator
SEED
=
2020
...
...
python/paddle/fluid/tests/unittests/dygraph_to_static/test_save_inference_model.py
浏览文件 @
bc01d56e
...
...
@@ -15,16 +15,15 @@
import
os
import
tempfile
import
unittest
import
numpy
as
np
import
paddle
import
paddle.fluid
as
fluid
from
paddle.fluid.dygraph.io
import
INFER_MODEL_SUFFIX
,
INFER_PARAMS_SUFFIX
from
paddle.jit
import
ProgramTranslator
from
paddle.jit.api
import
declarative
from
paddle.jit.dy2static.partial_program
import
(
partial_program_from
,
)
from
paddle.fluid.dygraph.io
import
INFER_MODEL_SUFFIX
,
INFER_PARAMS_SUFFIX
from
paddle.jit.dy2static.partial_program
import
partial_program_from
SEED
=
2020
...
...
python/paddle/fluid/tests/unittests/dygraph_to_static/test_save_load.py
浏览文件 @
bc01d56e
...
...
@@ -12,16 +12,16 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import
unittest
import
os
import
tempfile
import
unittest
import
numpy
as
np
import
paddle.fluid
as
fluid
from
test_fetch_feed
import
Linear
from
paddle.jit
import
ProgramTranslator
import
paddle.fluid
as
fluid
from
paddle.fluid.optimizer
import
AdamOptimizer
from
test_fetch_feed
import
Linea
r
from
paddle.jit
import
ProgramTranslato
r
np
.
random
.
seed
(
2020
)
...
...
python/paddle/fluid/tests/unittests/dygraph_to_static/test_se_resnet.py
浏览文件 @
bc01d56e
...
...
@@ -25,11 +25,11 @@ from predictor_utils import PredictorTools
import
paddle
import
paddle.fluid
as
fluid
from
paddle.fluid.dygraph.base
import
to_variable
from
paddle.fluid.dygraph.nn
import
BatchNorm
from
paddle.nn
import
Linear
from
paddle.fluid.dygraph.io
import
INFER_MODEL_SUFFIX
,
INFER_PARAMS_SUFFIX
from
paddle.fluid.dygraph.nn
import
BatchNorm
from
paddle.jit
import
ProgramTranslator
from
paddle.jit.api
import
declarative
from
paddle.nn
import
Linear
SEED
=
2020
np
.
random
.
seed
(
SEED
)
...
...
python/paddle/fluid/tests/unittests/dygraph_to_static/test_sentiment.py
浏览文件 @
bc01d56e
...
...
@@ -19,12 +19,11 @@ from test_lac import DynamicGRU
import
paddle
import
paddle.fluid
as
fluid
from
paddle.fluid.dygraph.nn
import
Embedding
from
paddle.nn
import
Linear
from
paddle.fluid.dygraph
import
to_variable
from
paddle.fluid.dygraph.nn
import
Embedding
,
Linear
from
paddle.jit
import
ProgramTranslator
from
paddle.jit.api
import
declarative
from
paddle.nn
import
Linear
SEED
=
2020
program_translator
=
ProgramTranslator
()
...
...
python/paddle/fluid/tests/unittests/dygraph_to_static/test_seq2seq.py
浏览文件 @
bc01d56e
...
...
@@ -18,14 +18,13 @@ import time
import
unittest
import
numpy
as
np
from
seq2seq_dygraph_model
import
AttentionModel
,
BaseModel
from
seq2seq_utils
import
Seq2SeqModelHyperParams
,
get_data_iter
import
paddle.fluid
as
fluid
from
paddle.fluid.clip
import
GradientClipByGlobalNorm
from
paddle.jit
import
ProgramTranslator
from
seq2seq_dygraph_model
import
BaseModel
,
AttentionModel
from
seq2seq_utils
import
Seq2SeqModelHyperParams
from
seq2seq_utils
import
get_data_iter
place
=
(
fluid
.
CUDAPlace
(
0
)
if
fluid
.
is_compiled_with_cuda
()
else
fluid
.
CPUPlace
()
)
...
...
python/paddle/fluid/tests/unittests/dygraph_to_static/test_tsm.py
浏览文件 @
bc01d56e
...
...
@@ -23,12 +23,11 @@ from tsm_config_utils import merge_configs, parse_config, print_configs
import
paddle
import
paddle.fluid
as
fluid
from
paddle.fluid.dygraph
import
to_variable
from
paddle.fluid.dygraph.nn
import
BatchNorm
from
paddle.nn
import
Linear
from
paddle.jit.api
import
declarative
from
paddle.jit
import
ProgramTranslator
from
paddle.
fluid.dygraph
import
to_variabl
e
from
tsm_config_utils
import
merge_configs
,
parse_config
,
print_configs
from
paddle.
jit.api
import
declarativ
e
from
paddle.nn
import
Linear
random
.
seed
(
0
)
np
.
random
.
seed
(
0
)
...
...
python/paddle/fluid/tests/unittests/dygraph_to_static/test_word2vec.py
浏览文件 @
bc01d56e
...
...
@@ -14,13 +14,12 @@
import
math
import
random
import
paddle
import
numpy
as
np
import
paddle
import
paddle.fluid
as
fluid
import
unittest
import
numpy
as
np
import
paddle
import
paddle.fluid
as
fluid
from
paddle.fluid.dygraph.nn
import
Embedding
from
paddle.jit
import
ProgramTranslator
from
paddle.jit.api
import
declarative
...
...
python/paddle/fluid/tests/unittests/dygraph_to_static/transformer_dygraph_model.py
浏览文件 @
bc01d56e
...
...
@@ -18,15 +18,10 @@ import paddle
import
paddle.fluid
as
fluid
import
paddle.fluid.layers
as
layers
import
paddle.nn.functional
as
F
from
paddle.fluid.dygraph
import
(
Embedding
,
Layer
,
LayerNorm
,
to_variable
,
)
from
paddle.nn
import
Linear
from
paddle.fluid.dygraph
import
Embedding
,
Layer
,
LayerNorm
,
to_variable
from
paddle.fluid.layers.utils
import
map_structure
from
paddle.jit.api
import
dygraph_to_static_func
from
paddle.nn
import
Linear
def
position_encoding_init
(
n_position
,
d_pos_vec
):
...
...
python/paddle/fluid/tests/unittests/test_add_position_encoding_op.py
浏览文件 @
bc01d56e
...
...
@@ -11,9 +11,10 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import
math
import
unittest
import
numpy
as
np
import
math
from
op_test
import
OpTest
...
...
python/paddle/fluid/tests/unittests/test_affine_channel_op.py
浏览文件 @
bc01d56e
...
...
@@ -16,6 +16,7 @@ Unit testing for affine_channel_op
"""
import
unittest
import
numpy
as
np
from
op_test
import
OpTest
...
...
python/paddle/fluid/tests/unittests/test_data_norm_op.py
浏览文件 @
bc01d56e
...
...
@@ -14,13 +14,15 @@
"""This is unit test of Test data_norm Op."""
import
unittest
import
numpy
as
np
from
op_test
import
OpTest
import
paddle
import
paddle.fluid.core
as
core
from
paddle.fluid.op
import
Operator
import
paddle.fluid
as
fluid
from
op_test
import
OpTest
import
paddle.fluid.core
as
core
from
paddle.fluid
import
Program
,
program_guard
from
paddle.fluid.op
import
Operator
def
_reference_testing
(
x
,
batch_size
,
batch_sum
,
batch_square_sum
,
slot_dim
=-
1
):
...
...
python/paddle/fluid/tests/unittests/test_detach.py
浏览文件 @
bc01d56e
...
...
@@ -18,8 +18,8 @@ import numpy as np
import
paddle
import
paddle.fluid
as
fluid
from
paddle.nn
import
Linear
from
paddle.fluid.dygraph.base
import
to_variable
from
paddle.nn
import
Linear
class
Test_Detach
(
unittest
.
TestCase
):
...
...
python/paddle/fluid/tests/unittests/test_dygraph_mnist_fp16.py
浏览文件 @
bc01d56e
...
...
@@ -18,8 +18,8 @@ import numpy as np
import
paddle
import
paddle.fluid
as
fluid
from
paddle.nn
import
Linear
from
paddle.fluid.framework
import
_test_eager_guard
from
paddle.nn
import
Linear
class
SimpleImgConvPool
(
fluid
.
dygraph
.
Layer
):
...
...
python/paddle/fluid/tests/unittests/test_dygraph_multi_forward.py
浏览文件 @
bc01d56e
...
...
@@ -20,9 +20,9 @@ from test_imperative_base import new_program_scope
import
paddle
import
paddle.fluid
as
fluid
from
paddle.fluid
import
core
from
paddle.nn
import
Linear
from
paddle.fluid.dygraph.base
import
to_variable
from
paddle.fluid.optimizer
import
SGDOptimizer
from
paddle.nn
import
Linear
SEED
=
123123111
...
...
python/paddle/fluid/tests/unittests/test_executor_return_tensor_not_overwriting.py
浏览文件 @
bc01d56e
...
...
@@ -13,10 +13,11 @@
# limitations under the License.
import
unittest
import
paddle
import
numpy
as
np
from
op_test
import
OpTest
,
skip_check_grad_ci
import
paddle
import
paddle.fluid
as
fluid
...
...
python/paddle/fluid/tests/unittests/test_fill_zeros_like2_op.py
浏览文件 @
bc01d56e
...
...
@@ -16,6 +16,7 @@ import unittest
import
numpy
as
np
from
op_test
import
OpTest
from
paddle.fluid.framework
import
convert_np_dtype_to_dtype_
...
...
python/paddle/fluid/tests/unittests/test_fuse_elewise_add_act_pass.py
浏览文件 @
bc01d56e
...
...
@@ -14,10 +14,11 @@
import
os
import
unittest
import
numpy
import
numpy
from
parallel_executor_test_base
import
DeviceType
,
TestParallelExecutorBase
from
simple_nets
import
fc_with_batchnorm
,
init_data
,
simple_fc_net
import
paddle
import
paddle.fluid
as
fluid
import
paddle.fluid.core
as
core
...
...
python/paddle/fluid/tests/unittests/test_group_norm_op.py
浏览文件 @
bc01d56e
...
...
@@ -13,14 +13,15 @@
# limitations under the License.
import
unittest
import
numpy
as
np
from
op_test
import
OpTest
,
skip_check_grad_ci
from
testsuite
import
create_op
import
paddle
import
paddle.fluid.core
as
core
import
paddle.fluid
as
fluid
from
op_test
import
OpTest
,
skip_check_grad_ci
import
paddle.fluid.core
as
core
from
paddle.fluid.framework
import
_test_eager_guard
from
testsuite
import
create_op
def
group_norm_naive
(
x
,
scale
,
bias
,
epsilon
,
groups
,
data_layout
):
...
...
python/paddle/fluid/tests/unittests/test_imperative_basic.py
浏览文件 @
bc01d56e
...
...
@@ -19,8 +19,8 @@ from test_imperative_base import new_program_scope
import
paddle
import
paddle.fluid
as
fluid
from
paddle.fluid
import
core
import
paddle.fluid.dygraph_utils
as
dygraph_utils
from
paddle.fluid
import
core
from
paddle.fluid.dygraph.layer_object_helper
import
LayerObjectHelper
from
paddle.fluid.framework
import
_in_legacy_dygraph
,
_test_eager_guard
from
paddle.fluid.layer_helper
import
LayerHelper
...
...
python/paddle/fluid/tests/unittests/test_imperative_container_sequential.py
浏览文件 @
bc01d56e
...
...
@@ -15,10 +15,10 @@
import
unittest
import
numpy
as
np
from
paddle.nn
import
Linear
import
paddle.fluid
as
fluid
from
paddle.fluid.framework
import
_test_eager_guard
from
paddle.nn
import
Linear
class
TestImperativeContainerSequential
(
unittest
.
TestCase
):
...
...
python/paddle/fluid/tests/unittests/test_imperative_deepcf.py
浏览文件 @
bc01d56e
...
...
@@ -24,8 +24,8 @@ import paddle
import
paddle.fluid
as
fluid
import
paddle.fluid.core
as
core
from
paddle.fluid.dygraph.base
import
to_variable
from
paddle.nn
import
Linear
from
paddle.fluid.framework
import
_test_eager_guard
from
paddle.nn
import
Linear
class
DMF
(
fluid
.
Layer
):
...
...
python/paddle/fluid/tests/unittests/test_imperative_framework.py
浏览文件 @
bc01d56e
...
...
@@ -20,7 +20,6 @@ from test_imperative_base import new_program_scope
import
paddle
import
paddle.fluid
as
fluid
from
paddle.fluid.framework
import
_test_eager_guard
import
paddle
class
MLP
(
fluid
.
Layer
):
...
...
python/paddle/fluid/tests/unittests/test_imperative_gan.py
浏览文件 @
bc01d56e
...
...
@@ -20,10 +20,10 @@ from test_imperative_base import new_program_scope
import
paddle
import
paddle.fluid
as
fluid
import
paddle.fluid.core
as
core
from
paddle.nn
import
Linear
from
paddle.fluid.dygraph.base
import
to_variable
from
paddle.fluid.framework
import
_test_eager_guard
from
paddle.fluid.optimizer
import
SGDOptimizer
from
paddle.nn
import
Linear
class
Discriminator
(
fluid
.
Layer
):
...
...
python/paddle/fluid/tests/unittests/test_imperative_layer_trainable.py
浏览文件 @
bc01d56e
...
...
@@ -16,10 +16,10 @@ import unittest
import
numpy
as
np
import
paddle
import
paddle.fluid
as
fluid
import
paddle.fluid.dygraph
as
dygraph
from
paddle.fluid.framework
import
_test_eager_guard
import
paddle
class
TestImperativeLayerTrainable
(
unittest
.
TestCase
):
...
...
python/paddle/fluid/tests/unittests/test_imperative_load_static_param.py
浏览文件 @
bc01d56e
...
...
@@ -27,13 +27,9 @@ from paddle.fluid.dygraph.nn import (
Embedding
,
GroupNorm
,
LayerNorm
,
NCE
,
PRelu
,
)
from
paddle.nn
import
Linear
import
numpy
as
np
import
os
import
tempfile
class
TestDygraphLoadStatic
(
unittest
.
TestCase
):
...
...
python/paddle/fluid/tests/unittests/test_imperative_mnist.py
浏览文件 @
bc01d56e
...
...
@@ -15,16 +15,15 @@
import
unittest
import
numpy
as
np
from
test_imperative_base
import
new_program_scope
from
utils
import
DyGraphProgramDescTracerTestHelper
import
paddle
import
paddle.fluid
as
fluid
from
paddle.fluid
import
core
from
paddle.fluid.framework
import
_in_legacy_dygraph
,
_test_eager_guard
from
paddle.fluid.optimizer
import
SGDOptimizer
from
paddle.nn
import
Linear
from
test_imperative_base
import
new_program_scope
from
utils
import
DyGraphProgramDescTracerTestHelper
from
paddle.fluid.framework
import
_test_eager_guard
,
_in_legacy_dygraph
class
SimpleImgConvPool
(
fluid
.
dygraph
.
Layer
):
...
...
python/paddle/fluid/tests/unittests/test_imperative_ocr_attention_model.py
浏览文件 @
bc01d56e
...
...
@@ -21,14 +21,9 @@ import paddle
import
paddle.fluid
as
fluid
from
paddle.fluid
import
core
from
paddle.fluid.dygraph.base
import
to_variable
from
paddle.fluid.dygraph.nn
import
(
BatchNorm
,
Embedding
,
GRUUnit
,
Linear
,
)
from
paddle.nn
import
Linear
from
paddle.fluid.dygraph.nn
import
BatchNorm
,
Embedding
,
GRUUnit
,
Linear
from
paddle.fluid.framework
import
_test_eager_guard
from
paddle.nn
import
Linear
class
Config
:
...
...
python/paddle/fluid/tests/unittests/test_imperative_optimizer.py
浏览文件 @
bc01d56e
...
...
@@ -16,10 +16,13 @@ import itertools
import
unittest
import
numpy
as
np
from
test_imperative_base
import
new_program_scope
import
paddle
import
paddle.fluid
as
fluid
from
paddle.distributed.fleet.meta_optimizers
import
DGCMomentumOptimizer
from
paddle.fluid
import
core
from
paddle.fluid.framework
import
_test_eager_guard
from
paddle.fluid.optimizer
import
(
AdadeltaOptimizer
,
AdagradOptimizer
,
...
...
@@ -39,10 +42,6 @@ from paddle.fluid.optimizer import (
RMSPropOptimizer
,
SGDOptimizer
,
)
from
test_imperative_base
import
new_program_scope
from
paddle.fluid.framework
import
_test_eager_guard
from
paddle.distributed.fleet.meta_optimizers
import
DGCMomentumOptimizer
# Note(wangzhongpu)
# In dygraph, don't support ModelAverage, DGCMomentumOptimizer, ExponentialMovingAverage, PipelineOptimizer, LookaheadOptimizer, RecomputeOptimizer.
...
...
python/paddle/fluid/tests/unittests/test_imperative_optimizer_v2.py
浏览文件 @
bc01d56e
...
...
@@ -16,10 +16,13 @@ import itertools
import
unittest
import
numpy
as
np
from
test_imperative_base
import
new_program_scope
import
paddle
import
paddle.fluid
as
fluid
from
paddle.distributed.fleet.meta_optimizers
import
DGCMomentumOptimizer
from
paddle.fluid
import
core
from
paddle.fluid.framework
import
_test_eager_guard
from
paddle.fluid.optimizer
import
(
AdadeltaOptimizer
,
AdagradOptimizer
,
...
...
@@ -36,10 +39,6 @@ from paddle.fluid.optimizer import (
RecomputeOptimizer
,
RMSPropOptimizer
,
)
from
test_imperative_base
import
new_program_scope
from
paddle.fluid.framework
import
_test_eager_guard
from
paddle.distributed.fleet.meta_optimizers
import
DGCMomentumOptimizer
# Note(wangzhongpu)
# In dygraph, don't support ModelAverage, DGCMomentumOptimizer, ExponentialMovingAverage, PipelineOptimizer, LookaheadOptimizer, RecomputeOptimizer.
...
...
python/paddle/fluid/tests/unittests/test_imperative_partitial_backward.py
浏览文件 @
bc01d56e
...
...
@@ -16,9 +16,9 @@ import unittest
import
numpy
as
np
import
paddle
import
paddle.fluid
as
fluid
from
paddle.fluid.framework
import
_test_eager_guard
import
paddle
class
TestImperativePartitialBackward
(
unittest
.
TestCase
):
...
...
python/paddle/fluid/tests/unittests/test_imperative_reinforcement.py
浏览文件 @
bc01d56e
...
...
@@ -15,11 +15,11 @@
import
unittest
import
numpy
as
np
from
test_imperative_base
import
new_program_scope
import
paddle
import
paddle.fluid
as
fluid
from
paddle.fluid
import
core
from
test_imperative_base
import
new_program_scope
from
paddle.fluid.framework
import
_test_eager_guard
from
paddle.fluid.optimizer
import
SGDOptimizer
...
...
python/paddle/fluid/tests/unittests/test_imperative_resnet.py
浏览文件 @
bc01d56e
...
...
@@ -20,8 +20,7 @@ from utils import DyGraphProgramDescTracerTestHelper, is_equal_program
import
paddle
import
paddle.fluid
as
fluid
from
paddle.fluid
import
core
from
paddle.fluid
import
BatchNorm
from
paddle.fluid
import
BatchNorm
,
core
from
paddle.fluid.dygraph.base
import
to_variable
from
paddle.fluid.framework
import
_in_legacy_dygraph
,
_test_eager_guard
from
paddle.fluid.layer_helper
import
LayerHelper
...
...
python/paddle/fluid/tests/unittests/test_imperative_se_resnext.py
浏览文件 @
bc01d56e
...
...
@@ -21,7 +21,6 @@ import paddle
import
paddle.fluid
as
fluid
from
paddle.fluid
import
core
from
paddle.fluid.dygraph.nn
import
BatchNorm
from
test_imperative_base
import
new_program_scope
from
paddle.fluid.framework
import
_test_eager_guard
from
paddle.fluid.layer_helper
import
LayerHelper
...
...
python/paddle/fluid/tests/unittests/test_imperative_trace_non_persistable_inputs.py
浏览文件 @
bc01d56e
...
...
@@ -16,7 +16,7 @@ import os
import
unittest
import
numpy
as
np
import
os
import
paddle
import
paddle.fluid
as
fluid
...
...
python/paddle/fluid/tests/unittests/test_imperative_transformer_sorted_gradient.py
浏览文件 @
bc01d56e
...
...
@@ -19,15 +19,12 @@ from test_imperative_base import new_program_scope
import
paddle
import
paddle.fluid
as
fluid
from
paddle.fluid
import
Embedding
,
LayerNorm
,
Layer
from
paddle.nn
import
Linear
from
paddle.fluid.dygraph
import
to_variable
,
guard
from
test_imperative_base
import
new_program_scope
from
paddle.fluid.framework
import
_in_legacy_dygraph
,
_test_eager_guard
from
paddle.fluid
import
core
import
numpy
as
np
import
paddle.nn.functional
as
F
from
paddle.fluid
import
Embedding
,
Layer
,
LayerNorm
,
core
from
paddle.fluid.dygraph
import
guard
,
to_variable
from
paddle.fluid.framework
import
_in_legacy_dygraph
,
_test_eager_guard
from
paddle.jit
import
TracedLayer
from
paddle.nn
import
Linear
np
.
set_printoptions
(
suppress
=
True
)
...
...
python/paddle/fluid/tests/unittests/test_isfinite_op.py
浏览文件 @
bc01d56e
...
...
@@ -16,6 +16,7 @@ import unittest
import
numpy
as
np
from
op_test
import
OpTest
import
paddle.fluid.core
as
core
...
...
python/paddle/fluid/tests/unittests/test_jit_save_load.py
浏览文件 @
bc01d56e
...
...
@@ -23,11 +23,11 @@ import numpy as np
import
paddle
import
paddle.fluid
as
fluid
from
paddle.nn
import
Linear
from
paddle.fluid
import
unique_name
from
paddle.fluid.dygraph.io
import
INFER_PARAMS_INFO_SUFFIX
from
paddle.fluid.layers.utils
import
flatten
from
paddle.jit.api
import
declarative
from
paddle.nn
import
Linear
from
paddle.static
import
InputSpec
BATCH_SIZE
=
32
...
...
python/paddle/fluid/tests/unittests/test_learning_rate_scheduler.py
浏览文件 @
bc01d56e
...
...
@@ -14,13 +14,15 @@
import
copy
import
math
import
numpy
as
np
import
unittest
import
numpy
as
np
import
paddle
import
paddle.fluid
as
fluid
import
paddle.fluid.layers
as
layers
import
paddle.fluid.framework
as
framework
import
paddle.fluid.core
as
core
import
paddle.fluid.framework
as
framework
import
paddle.fluid.layers
as
layers
def
exponential_decay
(
...
...
python/paddle/fluid/tests/unittests/test_multiprocess_dataloader_dynamic.py
浏览文件 @
bc01d56e
...
...
@@ -15,9 +15,6 @@
import
sys
import
time
import
unittest
import
numpy
as
np
import
paddle
from
paddle.nn
import
Linear
import
numpy
as
np
from
test_multiprocess_dataloader_static
import
(
...
...
@@ -31,8 +28,10 @@ from test_multiprocess_dataloader_static import (
prepare_places
,
)
import
paddle
import
paddle.fluid
as
fluid
from
paddle.io
import
DataLoader
from
paddle.nn
import
Linear
class
SimpleFCNet
(
fluid
.
dygraph
.
Layer
):
...
...
python/paddle/fluid/tests/unittests/test_multiprocess_dataloader_iterable_dataset_dynamic.py
浏览文件 @
bc01d56e
...
...
@@ -15,10 +15,6 @@
import
sys
import
time
import
unittest
import
numpy
as
np
import
paddle
from
paddle.nn
import
Linear
import
numpy
as
np
from
test_multiprocess_dataloader_iterable_dataset_static
import
(
...
...
@@ -32,8 +28,10 @@ from test_multiprocess_dataloader_iterable_dataset_static import (
prepare_places
,
)
import
paddle
import
paddle.fluid
as
fluid
from
paddle.io
import
DataLoader
from
paddle.nn
import
Linear
class
SimpleFCNet
(
fluid
.
dygraph
.
Layer
):
...
...
python/paddle/fluid/tests/unittests/test_ones_op.py
浏览文件 @
bc01d56e
...
...
@@ -17,7 +17,6 @@ import unittest
import
numpy
as
np
import
paddle
import
numpy
as
np
class
ApiOnesTest
(
unittest
.
TestCase
):
...
...
python/paddle/fluid/tests/unittests/test_paddle_save_load.py
浏览文件 @
bc01d56e
...
...
@@ -12,19 +12,20 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import
unittest
import
numpy
as
np
import
os
from
io
import
BytesIO
import
tempfile
import
unittest
from
io
import
BytesIO
import
numpy
as
np
from
test_imperative_base
import
new_program_scope
import
paddle
import
paddle.fluid
as
fluid
import
paddle.fluid.framework
as
framework
import
paddle.nn
as
nn
import
paddle.optimizer
as
opt
import
paddle.fluid
as
fluid
from
paddle.fluid.optimizer
import
Adam
import
paddle.fluid.framework
as
framework
from
test_imperative_base
import
new_program_scope
from
paddle.optimizer.lr
import
LRScheduler
BATCH_SIZE
=
16
...
...
python/paddle/fluid/tests/unittests/test_pool3d_op.py
浏览文件 @
bc01d56e
...
...
@@ -13,11 +13,12 @@
# limitations under the License.
import
unittest
import
numpy
as
np
from
op_test
import
OpTest
import
paddle
import
paddle.fluid.core
as
core
from
op_test
import
OpTest
def
adaptive_start_index
(
index
,
input_size
,
output_size
):
...
...
python/paddle/fluid/tests/unittests/test_roi_pool_op.py
浏览文件 @
bc01d56e
...
...
@@ -12,14 +12,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import
paddle
import
unittest
import
numpy
as
np
import
math
import
sys
import
unittest
from
decimal
import
ROUND_HALF_UP
,
Decimal
import
numpy
as
np
from
op_test
import
OpTest
from
decimal
import
Decimal
,
ROUND_HALF_UP
import
paddle
def
_round
(
x
):
...
...
python/paddle/fluid/tests/unittests/test_sigmoid_cross_entropy_with_logits_op.py
浏览文件 @
bc01d56e
...
...
@@ -12,14 +12,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import
unittest
import
numpy
as
np
from
op_test
import
OpTest
from
scipy.special
import
logit
from
scipy.special
import
expit
import
unittest
from
paddle.fluid
import
Program
,
program_guard
import
paddle.fluid
as
fluid
from
scipy.special
import
expit
,
logit
import
paddle
import
paddle.fluid
as
fluid
from
paddle.fluid
import
Program
,
program_guard
class
TestSigmoidCrossEntropyWithLogitsOp1
(
OpTest
):
...
...
python/paddle/fluid/tests/unittests/test_similarity_focus_op.py
浏览文件 @
bc01d56e
...
...
@@ -13,6 +13,7 @@
# limitations under the License.
import
unittest
import
numpy
as
np
from
op_test
import
OpTest
...
...
python/paddle/fluid/tests/unittests/test_size_op.py
浏览文件 @
bc01d56e
...
...
@@ -13,11 +13,12 @@
# limitations under the License.
import
unittest
import
numpy
as
np
import
paddle
import
paddle.fluid
as
fluid
from
op_test
import
OpTest
import
paddle
import
paddle.fluid
as
fluid
class
TestSizeOp
(
OpTest
):
...
...
python/paddle/fluid/tests/unittests/test_static_save_load.py
浏览文件 @
bc01d56e
...
...
@@ -13,18 +13,20 @@
# limitations under the License.
import
errno
import
os
import
pickle
import
tempfile
import
unittest
import
numpy
as
np
from
test_imperative_base
import
new_program_scope
import
paddle
import
paddle.fluid
as
fluid
import
paddle.fluid.core
as
core
import
paddle.fluid.framework
as
framework
from
paddle.fluid.optimizer
import
Adam
from
test_imperative_base
import
new_program_scope
import
numpy
as
np
import
pickle
import
os
import
errno
import
tempfile
paddle
.
enable_static
()
...
...
python/paddle/fluid/tests/unittests/utils.py
浏览文件 @
bc01d56e
...
...
@@ -12,10 +12,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from
paddle.fluid.framework
import
_dygraph_guard
import
paddle.fluid
as
fluid
import
numpy
as
np
import
paddle.fluid
as
fluid
from
paddle.fluid.framework
import
_dygraph_guard
__all__
=
[
'DyGraphProgramDescTracerTestHelper'
,
'is_equal_program'
]
...
...
python/paddle/fluid/tests/unittests/xpu/test_affine_channel_op_xpu.py
浏览文件 @
bc01d56e
...
...
@@ -20,8 +20,10 @@ import sys
sys
.
path
.
append
(
".."
)
import
unittest
import
numpy
as
np
from
op_test_xpu
import
XPUOpTest
import
paddle
import
paddle.fluid.core
as
core
...
...
python/paddle/hapi/progressbar.py
浏览文件 @
bc01d56e
...
...
@@ -13,10 +13,11 @@
# limitations under the License.
import
os
import
struct
import
sys
import
time
import
numpy
as
np
import
struct
__all__
=
[]
...
...
python/paddle/incubate/multiprocessing/reductions.py
浏览文件 @
bc01d56e
...
...
@@ -12,18 +12,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import
paddle
import
copy
# TODO: check the hooks of tensor
# TODO: check serializing named tensor
# TODO: check influence on autograd
import
sys
import
copy
import
threading
from
multiprocessing.util
import
register_after_fork
from
collections
import
OrderedDict
from
multiprocessing.reduction
import
ForkingPickler
from
multiprocessing.util
import
register_after_fork
from
collections
import
OrderedDict
import
paddle
def
_supported_check
():
...
...
python/paddle/inference/wrapper.py
浏览文件 @
bc01d56e
...
...
@@ -12,15 +12,21 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import
paddle.fluid.core
as
core
from
paddle.fluid.core
import
AnalysisConfig
,
PaddleDType
,
PaddlePlace
from
paddle.fluid.core
import
PaddleInferPredictor
,
PaddleInferTensor
from
paddle.fluid.core
import
convert_to_mixed_precision_bind
import
os
import
numpy
as
np
from
typing
import
Set
import
numpy
as
np
import
paddle.fluid.core
as
core
from
paddle.fluid.core
import
(
AnalysisConfig
,
PaddleDType
,
PaddleInferPredictor
,
PaddleInferTensor
,
PaddlePlace
,
convert_to_mixed_precision_bind
,
)
DataType
=
PaddleDType
PlaceType
=
PaddlePlace
PrecisionType
=
AnalysisConfig
.
Precision
...
...
python/paddle/static/nn/common.py
浏览文件 @
bc01d56e
...
...
@@ -13,19 +13,17 @@
# limitations under the License.
import
paddle
from
paddle.fluid.param_attr
import
ParamAttr
from
paddle.fluid.initializer
import
Normal
,
Constant
from
paddle.fluid.framework
import
static_only
,
Variable
,
_non_static_mode
from
paddle.fluid.layers.layer_function_generator
import
templatedoc
from
paddle.fluid.data_feeder
import
check_dtype
from
paddle.common_ops_import
import
(
LayerHelper
,
check_type
,
check_variable_and_dtype
,
utils
,
LayerHelper
,
)
from
paddle.fluid.data_feeder
import
check_dtype
from
paddle.fluid.framework
import
Variable
,
_non_static_mode
,
static_only
from
paddle.fluid.initializer
import
Constant
,
Normal
from
paddle.fluid.layers.layer_function_generator
import
templatedoc
from
paddle.fluid.param_attr
import
ParamAttr
__all__
=
[]
...
...
python/paddle/vision/datasets/folder.py
浏览文件 @
bc01d56e
...
...
@@ -13,6 +13,7 @@
# limitations under the License.
import
os
from
PIL
import
Image
import
paddle
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录