Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove packages in __all__ #32759

Merged
merged 4 commits into from
May 7, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions python/paddle/__init__.py
Original file line number Diff line number Diff line change
@@ -269,10 +269,10 @@

# high-level api
from .hapi import Model # noqa: F401
from .hapi import callbacks # noqa: F401
from . import callbacks # noqa: F401
from .hapi import summary # noqa: F401
from .hapi import flops # noqa: F401
from .hapi import hub # noqa: F401
from . import hub # noqa: F401

import paddle.text # noqa: F401
import paddle.vision # noqa: F401
@@ -335,10 +335,8 @@
'unsqueeze_',
'argmax',
'Model',
'callbacks',
'summary',
'flops',
'hub',
'sort',
'split',
'logical_and',
31 changes: 31 additions & 0 deletions python/paddle/callbacks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# 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.

from .hapi.callbacks import Callback # noqa: F401
from .hapi.callbacks import ProgBarLogger # noqa: F401
from .hapi.callbacks import ModelCheckpoint # noqa: F401
from .hapi.callbacks import VisualDL # noqa: F401
from .hapi.callbacks import LRScheduler # noqa: F401
from .hapi.callbacks import EarlyStopping # noqa: F401
from .hapi.callbacks import ReduceLROnPlateau # noqa: F401

__all__ = [ #noqa
'Callback',
'ProgBarLogger',
'ModelCheckpoint',
'VisualDL',
'LRScheduler',
'EarlyStopping',
'ReduceLROnPlateau'
]
5 changes: 1 addition & 4 deletions python/paddle/hapi/callbacks.py
Original file line number Diff line number Diff line change
@@ -25,10 +25,7 @@

from .progressbar import ProgressBar

__all__ = [
'Callback', 'ProgBarLogger', 'ModelCheckpoint', 'VisualDL', 'LRScheduler',
'EarlyStopping', 'ReduceLROnPlateau'
]
__all__ = []


def config_callbacks(callbacks=None,
21 changes: 21 additions & 0 deletions python/paddle/hub.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# 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.

from .hapi.hub import list # noqa: F401
from .hapi.hub import help # noqa: F401
from .hapi.hub import load # noqa: F401

__all__ = [ #noqa
'list', 'help', 'load'
]
2 changes: 0 additions & 2 deletions python/paddle/nn/__init__.py
Original file line number Diff line number Diff line change
@@ -232,10 +232,8 @@ def weight_norm(*args):
'MaxPool3D',
'AdaptiveMaxPool2D',
'Hardshrink',
'clip',
'Softplus',
'KLDivLoss',
'clip_by_norm',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个API虽然放在这里不太合适,但不能直接删除。

  1. 建议放到paddle.clip_by_norm位置,跟paddle.clip放一起,表示是对基础Tensor的一个操作。
  2. 这里的api先保留,但需要打印deprecated警告

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clip_by_norm没有真是实现,剔除空名

'AvgPool2D',
'L1Loss',
'LeakyReLU',
11 changes: 3 additions & 8 deletions python/paddle/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -19,18 +19,13 @@
from .lazy_import import try_import # noqa: F401
from .op_version import OpLastCheckpointChecker # noqa: F401
from .install_check import run_check # noqa: F401
from ..fluid.framework import unique_name # noqa: F401
from . import unique_name # noqa: F401
from ..fluid.framework import require_version # noqa: F401

from . import download # noqa: F401
from . import image_util # noqa: F401
from . import cpp_extension # noqa: F401

__all__ = [ #noqa
'deprecated',
'download',
'run_check',
'unique_name',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unique_name虽然是一个文件,但底层的API需要暴露
比如:paddle.utils.unique_name.guard()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done,再paddle/utils新增unique_name.py文件开放__all__列表

'require_version',
'try_import'
__all__ = [ #noqa
'deprecated', 'run_check', 'require_version', 'try_import'
]
2 changes: 1 addition & 1 deletion python/paddle/utils/download.py
Original file line number Diff line number Diff line change
@@ -55,7 +55,7 @@ def __exit__(self, exc_type, exc_val, exc_tb):
import logging
logger = logging.getLogger(__name__)

__all__ = []
__all__ = ['get_weights_path_from_url']

WEIGHTS_HOME = osp.expanduser("~/.cache/paddle/hapi/weights")

21 changes: 21 additions & 0 deletions python/paddle/utils/unique_name.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# 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.

from ..fluid.unique_name import generate # noqa: F401
from ..fluid.unique_name import switch # noqa: F401
from ..fluid.unique_name import guard # noqa: F401

__all__ = [ #noqa
'generate', 'switch', 'guard'
]