
    Αi                       % S SK Jr  S SKJrJr  S SKJr  S SKJr  SSK	J
r
JrJrJr  \(       a  S SKJr  \\\\4   rS\S	'   SS
 jr S   SS jjr S     SS jjrSS jrSSS jjrSSS jjrSSS jjrSSS jjrg)    )annotations)TYPE_CHECKINGUnion)	TypeAlias)core   )EventStreamcreate_eventcreate_stream)CPUPlacer   _CPUPlaceLikec                     g)a
  
Return the number of GPUs available.

Returns:
    int: the number of GPUs available.

Note:
    This function returns 0 when compiled without CUDA support.

Examples:
    .. code-block:: python

        >>> import paddle

        >>> paddle.device.device_count()

r    r       Q/var/www/html/banglarbhumi/venv/lib/python3.13/site-packages/paddle/device/cpu.pydevice_countr   (   s    $ r   Nc                H    [         R                  " 5       R                  5       $ )a  
Get the random state for the default generator.

Returns:
    Tensor: The random state tensor.

Examples:

    .. code-block:: python

        >>> # doctest: +REQUIRES(env:CUSTOM_DEVICE)
        >>> import paddle
        >>> paddle.device.get_rng_state()

)r   default_cpu_generator	get_statedevices    r   get_rng_stater   =   s    $ %%'1133r   c                L    [         R                  " 5       R                  U 5        g)a&  
Set the random number generator state of the specified device.

Args:
    new_state (core.GeneratorState): The desired RNG state to set.
        This should be a state object previously obtained from ``get_rng_state()``.
    device (DeviceLike, optional): The device to set the RNG state for.
        If not specified, uses the current default device (as returned by ``paddle.framework._current_expected_place_()``).
        Can be a device object, integer device ID, or device string.

Returns:
    None

Examples:
    .. code-block:: python

        >>> import paddle
        >>> # Save RNG state
        >>> state = paddle.device.get_rng_state()
        >>> # Do some random operations
        >>> x = paddle.randn([2, 3])
        >>> # Restore RNG state
        >>> paddle.device.set_rng_state(state)
N)r   r   	set_state)	new_stater   s     r   set_rng_stater   R   s    6 	 **95r   c                b    [        U 5      n [        R                  " 5       R                  U 5        g)aw  Set the seed for generating random numbers for the current Device.

.. warning::
    If you are working with a multi-Device model, this function is insufficient
    to get determinism.  To seed all Devices, use :func:`manual_seed_all`.

Sets the seed for global default generator, which manages the random number generation.

Args:
    seed(int): The random seed to set.

Returns:
    None

Examples:
    .. code-block:: python

        >>> import paddle
        >>> paddle.device.manual_seed(102)
        >>> # paddle.cuda.manual_seed(102) is equivalent to paddle.device.manual_seed(102)
        >>> paddle.cuda.manual_seed(102)

N)intr   r   manual_seed)seeds    r   r    r    p   s$    0 t9D ,,T2r   c                    [        S5      e)z
The API max_memory_allocated is not supported in CPU PaddlePaddle.
Please reinstall PaddlePaddle with GPU or XPU support to call this API.
zThe API paddle.device.max_memory_allocated is not supported in CPU PaddlePaddle. Please reinstall PaddlePaddle with GPU or XPU support to call this API.
ValueErrorr   s    r   max_memory_allocatedr%          
 	R r   c                    [        S5      e)z
The API max_memory_reserved is not supported in CPU PaddlePaddle.
Please reinstall PaddlePaddle with GPU or XPU support to call this API.
zThe API paddle.device.max_memory_reserved is not supported in CPU PaddlePaddle. Please reinstall PaddlePaddle with GPU or XPU support to call this API.r#   r   s    r   max_memory_reservedr(      r&   r   c                    [        S5      e)z
The API reset_max_memory_allocated is not supported in CPU PaddlePaddle.
Please reinstall PaddlePaddle with GPU or XPU support to call this API.
zThe API paddle.device.reset_max_memory_allocated is not supported in CPU PaddlePaddle. Please reinstall PaddlePaddle with GPU or XPU support to call this API.r#   r   s    r   reset_max_memory_allocatedr*      r&   r   c                    [        S5      e)z
The API reset_max_memory_reserved is not supported in CPU PaddlePaddle.
Please reinstall PaddlePaddle with GPU or XPU support to call this API.
zThe API paddle.device.reset_max_memory_reserved is not supported in CPU PaddlePaddle. Please reinstall PaddlePaddle with GPU or XPU support to call this API.r#   r   s    r   reset_max_memory_reservedr,      r&   r   )returnr   )N)r   _CPUPlaceLike | Noner-   core.GeneratorState)r   r/   r   r.   r-   None)r!   r   r-   r0   )r   r.   r-   r   )r   r.   r-   r0   )
__future__r   typingr   r   typing_extensionsr   paddle.baser   custom_streamsr	   r
   r   r   paddler   strr   r   __annotations__r   r   r   r    r%   r(   r*   r,   r   r   r   <module>r9      s    # ' '   $	 M9 , $(4 44, DH6"6,@6	6<38r   