from __future__ import annotations

from typing import Any, Optional

class ProgramStats:
    block: Any = ...
    ops: Any = ...
    op_deps: Any = ...
    var_op_deps: Any = ...
    def __init__(self, block: Any, ops: Any) -> None: ...
    def get_input_nodes(self): ...
    def get_reserved_vars(self): ...
    def get_out_of_subgraph_vars(self, begin_op_idx: Any, end_op_idx: Any): ...
    def is_subgraph(self, var_group1: Any, var_group2: Any): ...
    def build_stats(self) -> None: ...
    def sort_checkpoints(self, checkpoints_name: Any): ...
    def modify_forward_desc_for_recompute(self) -> None: ...

def append_backward(
    loss: Any,
    parameter_list: Optional[Any] = ...,
    no_grad_set: Optional[Any] = ...,
    callbacks: Optional[Any] = ...,
    checkpoints: Optional[Any] = ...,
    distop_context: Optional[Any] = ...,
): ...
def gradients(targets: Any, inputs: Any, target_gradients: Optional[Any] = ..., no_grad_set: Optional[Any] = ...): ...
