from __future__ import annotations

from typing import Any, Optional

from .._typing import NumbericSequence, ShapeLike, Tensor
from ..fluid import layers as layers
from ..fluid.data_feeder import check_dtype as check_dtype
from ..fluid.data_feeder import check_type as check_type
from ..fluid.data_feeder import check_variable_and_dtype as check_variable_and_dtype
from ..fluid.data_feeder import convert_dtype as convert_dtype
from ..fluid.dygraph.inplace_utils import (
    inplace_apis_in_dygraph_only as inplace_apis_in_dygraph_only,
)
from ..fluid.framework import in_dygraph_mode as in_dygraph_mode
from ..fluid.layer_helper import LayerHelper as LayerHelper
from ..fluid.layers import cast as cast
from ..fluid.layers import scatter_nd as scatter_nd
from ..fluid.layers import shard_index as shard_index
from ..fluid.layers import slice as slice
from ..fluid.layers import transpose as transpose
from ..fluid.layers import unstack as unstack
from ..fluid.layers import utils as utils
from ..framework import OpProtoHolder as OpProtoHolder
from ..framework import convert_np_dtype_to_dtype_ as convert_np_dtype_to_dtype_
from ..framework import core as core
from ..framework import dygraph_only as dygraph_only
from ..static import Variable as Variable
from ..static import device_guard as device_guard

def fill_(x: Any, value: Any): ...
def zero_(x: Any): ...
def fill_diagonal_(x: Any, value: Any, offset: int = ..., wrap: bool = ..., name: Optional[Any] = ...): ...
def fill_diagonal_tensor_(
    x: Any, y: Any, offset: int = ..., dim1: int = ..., dim2: int = ..., name: Optional[Any] = ...
): ...
def fill_diagonal_tensor(
    x: Any, y: Any, offset: int = ..., dim1: int = ..., dim2: int = ..., name: Optional[Any] = ...
): ...
def tolist(x: Any): ...
def concat(x: Any, axis: int = ..., name: Optional[Any] = ...): ...
def broadcast_tensors(input: Any, name: Optional[Any] = ...): ...
def flip(x: Any, axis: Any, name: Optional[Any] = ...): ...
def rot90(x: Any, k: int = ..., axes: Any = ..., name: Optional[Any] = ...): ...
def flatten(x: Any, start_axis: int = ..., stop_axis: int = ..., name: Optional[Any] = ...): ...
def flatten_(x: Any, start_axis: int = ..., stop_axis: int = ..., name: Optional[Any] = ...): ...
def roll(x: Any, shifts: Any, axis: Optional[Any] = ..., name: Optional[Any] = ...): ...
def stack(x: Any, axis: int = ..., name: Optional[Any] = ...): ...
def split(x: Any, num_or_sections: Any, axis: int = ..., name: Optional[Any] = ...): ...
def squeeze(x: Any, axis: Optional[Any] = ..., name: Optional[Any] = ...): ...
def squeeze_(x: Any, axis: Optional[Any] = ..., name: Optional[Any] = ...): ...
def unique_consecutive(
    x: Any,
    return_inverse: bool = ...,
    return_counts: bool = ...,
    axis: Optional[Any] = ...,
    dtype: str = ...,
    name: Optional[Any] = ...,
): ...
def unique(
    x: Any,
    return_index: bool = ...,
    return_inverse: bool = ...,
    return_counts: bool = ...,
    axis: Optional[Any] = ...,
    dtype: str = ...,
    name: Optional[Any] = ...,
): ...
def unsqueeze(x: Any, axis: Any, name: Optional[Any] = ...): ...
def unsqueeze_(x: Any, axis: Any, name: Optional[Any] = ...): ...
def gather(x: Any, index: Any, axis: Optional[Any] = ..., name: Optional[Any] = ...): ...
def unbind(input: Any, axis: int = ...): ...
def scatter(x: Any, index: Any, updates: Any, overwrite: bool = ..., name: Optional[Any] = ...): ...
def scatter_(x: Any, index: Any, updates: Any, overwrite: bool = ..., name: Optional[Any] = ...): ...
def scatter_nd_add(x: Any, index: Any, updates: Any, name: Optional[Any] = ...): ...
def chunk(x: Any, chunks: Any, axis: int = ..., name: Optional[Any] = ...): ...
def tile(x: Any, repeat_times: Any, name: Optional[Any] = ...): ...
def expand_as(x: Any, y: Any, name: Optional[Any] = ...): ...
def broadcast_to(x: Any, shape: Any, name: Optional[Any] = ...): ...
def expand(x: Any, shape: Any, name: Optional[Any] = ...): ...
def reshape(x: Any, shape: Any, name: Optional[Any] = ...): ...
def reshape_(x: Any, shape: Any, name: Optional[Any] = ...): ...
def gather_nd(x: Any, index: Any, name: Optional[Any] = ...): ...
def strided_slice(x: Any, axes: Any, starts: Any, ends: Any, strides: Any, name: Optional[Any] = ...): ...
def tensordot(x: Any, y: Any, axes: int = ..., name: Optional[Any] = ...): ...
def as_complex(x: Any, name: Optional[Any] = ...): ...
def as_real(x: Any, name: Optional[Any] = ...): ...
def repeat_interleave(x: Any, repeats: Any, axis: Optional[Any] = ..., name: Optional[Any] = ...): ...
def moveaxis(x: Any, source: Any, destination: Any, name: Optional[Any] = ...): ...
def non_negative_axis(arr: Any, axis: Any): ...
def infer_broadcast_shape(arr: Any, indices: Any, axis: Any): ...
def take_along_axis(arr: Any, indices: Any, axis: Any): ...
def put_along_axis(arr: Any, indices: Any, values: Any, axis: Any, reduce: str = ...): ...
def put_along_axis_(arr: Any, indices: Any, values: Any, axis: Any, reduce: str = ...): ...
def crop(x: Tensor, shape: ShapeLike = ..., offsets: NumbericSequence | Tensor = ..., name=Optional[str]) -> Tensor: ...
