from __future__ import annotations

from typing import Any, Optional

def enabled(): ...
def enable_dygraph(place: Optional[Any] = ...) -> None: ...
def disable_dygraph() -> None: ...
def no_grad(func: Optional[Any] = ...): ...

class no_grad_:
    def __call__(self, func: Any): ...
    orig: Any = ...
    def __enter__(self) -> None: ...
    def __exit__(self, *args: Any) -> None: ...

def guard(place: Optional[Any] = ...) -> None: ...
def grad(
    outputs: Any,
    inputs: Any,
    grad_outputs: Optional[Any] = ...,
    retain_graph: Optional[Any] = ...,
    create_graph: bool = ...,
    only_inputs: bool = ...,
    allow_unused: bool = ...,
    no_grad_vars: Optional[Any] = ...,
): ...
def to_variable(value: Any, name: Optional[Any] = ..., zero_copy: Optional[Any] = ..., dtype: Optional[Any] = ...): ...
