Skip to content

[Typing][C-52] Add type annotations for python/paddle/distributed/fleet/utils/__init__.py #66771

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

Merged
merged 2 commits into from
Aug 1, 2024
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
10 changes: 9 additions & 1 deletion python/paddle/distributed/fleet/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
# 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 __future__ import annotations

from typing import TYPE_CHECKING, Any, Callable

from paddle.distributed import fleet

Expand All @@ -24,10 +27,15 @@
from .fs import HDFSClient, LocalFS
from .ps_util import DistributedInfer

if TYPE_CHECKING:
from paddle.nn import Layer

__all__ = ["LocalFS", "recompute", "DistributedInfer", "HDFSClient"]


def recompute(function, *args, **kwargs):
def recompute(
function: Layer | Callable[..., Any], *args: Any, **kwargs: Any
) -> Any:
"""
recompute intermediate activations to save the memory.

Expand Down