o
    ãÊiÔ  ã                   @   sJ   d dl Z d dlm  mZ d dlmZ d dlmZ de j	de
fdd„ZdS )é    N)ÚDTensor)ÚFloat8TrainingTensorÚtensorÚreturnc                 C   s<   t | tƒrdS t | tƒrt| jƒS t | tjƒrt| jƒS dS )zl
    Check if the tensor is already casted to fp8, works if the local
    tensor is wrapped in DTensor.
    TF)Ú
isinstancer   r   Útensor_already_casted_to_fp8Ú_local_tensorÚfuncolÚAsyncCollectiveTensorÚelem)r   © r   úT/home/ubuntu/.local/lib/python3.10/site-packages/torchao/float8/distributed_utils.pyr      s   



r   )ÚtorchÚ)torch.distributed._functional_collectivesÚdistributedÚ_functional_collectivesr	   Útorch.distributed._tensorr   Ú%torchao.float8.float8_training_tensorr   ÚTensorÚboolr   r   r   r   r   Ú<module>   s
   