Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
9983892e
P
Paddle
项目概览
PaddlePaddle
/
Paddle
接近 2 年 前同步成功
通知
2323
Star
20933
Fork
5424
代码
文件
提交
分支
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看板
未验证
提交
9983892e
编写于
3月 20, 2023
作者:
A
Ainavo
提交者:
GitHub
3月 20, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[CodeStyle][UP004] remove useless object inheritance (#51771)
* add_up004_for_ruff * 修改配置文件并清除object * fix md
上级
5786f3e4
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
19 addition
and
18 deletion
+19
-18
paddle/fluid/imperative/README.md
paddle/fluid/imperative/README.md
+2
-2
pyproject.toml
pyproject.toml
+1
-0
python/paddle/device/__init__.py
python/paddle/device/__init__.py
+3
-3
python/paddle/distributed/fleet/base/runtime_factory.py
python/paddle/distributed/fleet/base/runtime_factory.py
+1
-1
python/paddle/distributed/passes/auto_parallel_bf16.py
python/paddle/distributed/passes/auto_parallel_bf16.py
+1
-1
python/paddle/distributed/passes/auto_parallel_sharding.py
python/paddle/distributed/passes/auto_parallel_sharding.py
+2
-2
python/paddle/fluid/tests/unittests/prim/model/bert.py
python/paddle/fluid/tests/unittests/prim/model/bert.py
+1
-1
python/paddle/fluid/tests/unittests/ps/static_gpubox_trainer.py
.../paddle/fluid/tests/unittests/ps/static_gpubox_trainer.py
+1
-1
python/paddle/fluid/tests/unittests/xpu/test_warpctc_op_xpu.py
...n/paddle/fluid/tests/unittests/xpu/test_warpctc_op_xpu.py
+1
-1
python/paddle/jit/dy2static/program_translator.py
python/paddle/jit/dy2static/program_translator.py
+1
-1
python/paddle/quantization/config.py
python/paddle/quantization/config.py
+2
-2
python/paddle/quantization/quantize.py
python/paddle/quantization/quantize.py
+1
-1
tools/parse_kernel_info.py
tools/parse_kernel_info.py
+2
-2
未找到文件。
paddle/fluid/imperative/README.md
浏览文件 @
9983892e
...
@@ -14,7 +14,7 @@ https://www.tensorflow.org/guide/eager
...
@@ -14,7 +14,7 @@ https://www.tensorflow.org/guide/eager
## API
## API
```
python
```
python
class
Layer
(
object
)
:
class
Layer
:
def
__call__
(
inputs
):
def
__call__
(
inputs
):
# build some parameter once.
# build some parameter once.
...
@@ -49,7 +49,7 @@ Longer term.
...
@@ -49,7 +49,7 @@ Longer term.
```
python
```
python
# Parent class.
# Parent class.
class
PyVarBase
(
object
)
:
class
PyVarBase
:
pass
pass
# Current python variable.
# Current python variable.
...
...
pyproject.toml
浏览文件 @
9983892e
...
@@ -35,6 +35,7 @@ select = [
...
@@ -35,6 +35,7 @@ select = [
# Pyupgrade
# Pyupgrade
"UP001"
,
"UP001"
,
"UP003"
,
"UP003"
,
"UP004"
,
"UP007"
,
"UP007"
,
"UP010"
,
"UP010"
,
"UP011"
,
"UP011"
,
...
...
python/paddle/device/__init__.py
浏览文件 @
9983892e
...
@@ -523,7 +523,7 @@ def get_available_custom_device():
...
@@ -523,7 +523,7 @@ def get_available_custom_device():
return
core
.
get_available_custom_device
()
return
core
.
get_available_custom_device
()
class
Event
(
object
)
:
class
Event
:
'''
'''
A device event wrapper around StreamBase.
A device event wrapper around StreamBase.
Parameters:
Parameters:
...
@@ -668,7 +668,7 @@ class Event(object):
...
@@ -668,7 +668,7 @@ class Event(object):
return
self
.
event_base
return
self
.
event_base
class
Stream
(
object
)
:
class
Stream
:
'''
'''
A device stream wrapper around StreamBase.
A device stream wrapper around StreamBase.
Parameters:
Parameters:
...
@@ -936,7 +936,7 @@ def set_stream(stream):
...
@@ -936,7 +936,7 @@ def set_stream(stream):
return
prev_stream
return
prev_stream
class
stream_guard
(
object
)
:
class
stream_guard
:
'''
'''
Notes:
Notes:
This API only supports dynamic graph mode currently.
This API only supports dynamic graph mode currently.
...
...
python/paddle/distributed/fleet/base/runtime_factory.py
浏览文件 @
9983892e
...
@@ -17,7 +17,7 @@ from ..runtime.collective_runtime import CollectiveRuntime
...
@@ -17,7 +17,7 @@ from ..runtime.collective_runtime import CollectiveRuntime
__all__
=
[]
__all__
=
[]
class
RuntimeFactory
(
object
)
:
class
RuntimeFactory
:
def
__init__
(
self
):
def
__init__
(
self
):
pass
pass
...
...
python/paddle/distributed/passes/auto_parallel_bf16.py
浏览文件 @
9983892e
...
@@ -45,7 +45,7 @@ from ..auto_parallel.utils import is_backward_op, is_forward_op, is_loss_op
...
@@ -45,7 +45,7 @@ from ..auto_parallel.utils import is_backward_op, is_forward_op, is_loss_op
world_process_group
=
get_world_process_group
()
world_process_group
=
get_world_process_group
()
class
BF16State
(
object
)
:
class
BF16State
:
def
__init__
(
self
,
block
):
def
__init__
(
self
,
block
):
self
.
_block
:
Block
=
block
self
.
_block
:
Block
=
block
self
.
_op_bf16_dict
=
{}
self
.
_op_bf16_dict
=
{}
...
...
python/paddle/distributed/passes/auto_parallel_sharding.py
浏览文件 @
9983892e
...
@@ -1787,7 +1787,7 @@ def group_param(sharding_info, fuse_size):
...
@@ -1787,7 +1787,7 @@ def group_param(sharding_info, fuse_size):
return
group_to_param_map
,
param_to_group_map
return
group_to_param_map
,
param_to_group_map
class
ShardingInfo
(
object
)
:
class
ShardingInfo
:
def
__init__
(
self
,
group
,
rank
,
params_grads
,
partition_algor
):
def
__init__
(
self
,
group
,
rank
,
params_grads
,
partition_algor
):
self
.
group
=
group
self
.
group
=
group
self
.
params_grads
=
dict
([(
p
.
name
,
(
p
,
g
))
for
p
,
g
in
params_grads
])
self
.
params_grads
=
dict
([(
p
.
name
,
(
p
,
g
))
for
p
,
g
in
params_grads
])
...
@@ -1869,7 +1869,7 @@ class ShardingInfo(object):
...
@@ -1869,7 +1869,7 @@ class ShardingInfo(object):
return
self
.
params_grads
.
get
(
param_name
,
None
)
return
self
.
params_grads
.
get
(
param_name
,
None
)
class
VarGroup
(
object
)
:
class
VarGroup
:
def
__init__
(
self
,
max_size
):
def
__init__
(
self
,
max_size
):
self
.
max_siez
=
max_size
self
.
max_siez
=
max_size
self
.
dtype
=
None
self
.
dtype
=
None
...
...
python/paddle/fluid/tests/unittests/prim/model/bert.py
浏览文件 @
9983892e
...
@@ -35,7 +35,7 @@ except ImportError:
...
@@ -35,7 +35,7 @@ except ImportError:
VOCAB_SIZE
=
30522
VOCAB_SIZE
=
30522
class
Stack
(
object
)
:
class
Stack
:
def
__init__
(
self
,
axis
=
0
,
dtype
=
None
):
def
__init__
(
self
,
axis
=
0
,
dtype
=
None
):
self
.
_axis
=
axis
self
.
_axis
=
axis
self
.
_dtype
=
dtype
self
.
_dtype
=
dtype
...
...
python/paddle/fluid/tests/unittests/ps/static_gpubox_trainer.py
浏览文件 @
9983892e
...
@@ -51,7 +51,7 @@ def get_dataset(inputs, config):
...
@@ -51,7 +51,7 @@ def get_dataset(inputs, config):
return
dataset
return
dataset
class
Main
(
object
)
:
class
Main
:
def
__init__
(
self
):
def
__init__
(
self
):
self
.
metrics
=
{}
self
.
metrics
=
{}
self
.
input_data
=
None
self
.
input_data
=
None
...
...
python/paddle/fluid/tests/unittests/xpu/test_warpctc_op_xpu.py
浏览文件 @
9983892e
...
@@ -36,7 +36,7 @@ paddle.enable_static()
...
@@ -36,7 +36,7 @@ paddle.enable_static()
CUDA_BLOCK_SIZE
=
32
CUDA_BLOCK_SIZE
=
32
class
CTCForward
(
object
)
:
class
CTCForward
:
def
__init__
(
def
__init__
(
self
,
self
,
softmax
,
softmax
,
...
...
python/paddle/jit/dy2static/program_translator.py
浏览文件 @
9983892e
...
@@ -1081,7 +1081,7 @@ class ParametersRecorder:
...
@@ -1081,7 +1081,7 @@ class ParametersRecorder:
return
id
(
program
)
return
id
(
program
)
class
FallbackProgramLayer
(
object
)
:
class
FallbackProgramLayer
:
__slots__
=
[
__slots__
=
[
'_instance'
,
'_instance'
,
'_dy_func'
,
'_dy_func'
,
...
...
python/paddle/quantization/config.py
浏览文件 @
9983892e
...
@@ -32,7 +32,7 @@ DEFAULT_QAT_LAYER_MAPPINGS: Dict[Layer, Layer] = {
...
@@ -32,7 +32,7 @@ DEFAULT_QAT_LAYER_MAPPINGS: Dict[Layer, Layer] = {
DEFAULT_LEAVES
=
[
nn
.
ReLU
,
nn
.
AvgPool2D
]
DEFAULT_LEAVES
=
[
nn
.
ReLU
,
nn
.
AvgPool2D
]
class
SingleLayerConfig
(
object
)
:
class
SingleLayerConfig
:
r
"""
r
"""
Configure how to quantize the activations and weights of a single layer.
Configure how to quantize the activations and weights of a single layer.
...
@@ -57,7 +57,7 @@ class SingleLayerConfig(object):
...
@@ -57,7 +57,7 @@ class SingleLayerConfig(object):
return
f
"activation:
{
self
.
_activation
}
\n
weight:
{
self
.
_weight
}
"
return
f
"activation:
{
self
.
_activation
}
\n
weight:
{
self
.
_weight
}
"
class
QuantConfig
(
object
)
:
class
QuantConfig
:
r
"""
r
"""
Configure how to quantize a model or a part of the model. It will map each layer to
Configure how to quantize a model or a part of the model. It will map each layer to
an instance of SingleLayerConfig by the settings. It provides diverse methods to set
an instance of SingleLayerConfig by the settings. It provides diverse methods to set
...
...
python/paddle/quantization/quantize.py
浏览文件 @
9983892e
...
@@ -25,7 +25,7 @@ from .base_quanter import BaseQuanter
...
@@ -25,7 +25,7 @@ from .base_quanter import BaseQuanter
from
.config
import
QuantConfig
from
.config
import
QuantConfig
class
Quantization
(
object
,
metaclass
=
abc
.
ABCMeta
):
class
Quantization
(
metaclass
=
abc
.
ABCMeta
):
r
"""
r
"""
Abstract class used to prepares a copy of the model for quantization calibration or quantization-aware training.
Abstract class used to prepares a copy of the model for quantization calibration or quantization-aware training.
Args:
Args:
...
...
tools/parse_kernel_info.py
浏览文件 @
9983892e
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
import
paddle
import
paddle
class
KernelInfo
(
object
)
:
class
KernelInfo
:
def
__init__
(
self
,
op_type
):
def
__init__
(
self
,
op_type
):
self
.
op_type
=
op_type
self
.
op_type
=
op_type
self
.
supported_dtypes
=
set
()
self
.
supported_dtypes
=
set
()
...
@@ -53,7 +53,7 @@ class KernelInfo(object):
...
@@ -53,7 +53,7 @@ class KernelInfo(object):
self
.
supported_dtypes
.
add
(
dtype_str
)
self
.
supported_dtypes
.
add
(
dtype_str
)
class
KernelRegistryStatistics
(
object
)
:
class
KernelRegistryStatistics
:
def
__init__
(
self
):
def
__init__
(
self
):
self
.
num_ops_for_dtypes
=
{
self
.
num_ops_for_dtypes
=
{
"all"
:
0
,
"all"
:
0
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录