Ë
    2ÆVhS  ã                   ód  — d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm	Z	 dd	lm
Z
 dd
lmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm Z  ddlm!Z! y) a’  Torch backend APIs.

# Note on device placement

Torch has a different device placement style compared to TF and JAX.
In short, variables/tensors are not created on GPU by default,
and the GPU cannot directly communicate with the CPU.
To bring Torch behavior in line with TF and JAX automated device placement,
we are doing the following to automate device placement if a GPU is available:

- Variables are created on GPU.
- Input data will be placed on GPU at the first `keras.layers.Layer` call.
- Tensor creation happens on GPU, e.g., `zeros()` will create a tensor on GPU.
- `convert_to_numpy` will bring the tensor to CPU before converting it to NumPy.
é    )Ú
name_scope)Úcore)Úimage)Úlinalg)Úmath)Únn)Únumpy)Úrandom)ÚIS_THREAD_SAFE)ÚSUPPORTS_RAGGED_TENSORS)ÚSUPPORTS_SPARSE_TENSORS)ÚVariable)Úcast)Úcompute_output_spec)Úcond)Úconvert_to_numpy)Úconvert_to_tensor)Údevice_scope)Ú	is_tensor)Úrandom_seed_dtype)Úscatter)Úshape)Ústop_gradient)Úto_torch_dtype)Úvectorized_map)Úcudnn_ok)Úgru)Úlstm)ÚrnnN)"Ú__doc__Ú#keras.src.backend.common.name_scoper   Úkeras.src.backend.torchr   r   r   r   r   r	   r
   Úkeras.src.backend.torch.corer   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   Úkeras.src.backend.torch.rnnr   r   r   r   © ó    úP/home/dcms/DCMS/lib/python3.12/site-packages/keras/src/backend/torch/__init__.pyú<module>r(      sc   ðñõ  ;Ý (Ý )Ý *Ý (Ý &Ý )Ý *Ý 7Ý @Ý @Ý 1Ý -Ý <Ý -Ý 9Ý :Ý 5Ý 2Ý :Ý 0Ý .Ý 6Ý 7Ý 7Ý 0Ý +Ý ,Þ +r&   