
    sg                     .    d dl Z d Zd ZdZ G d d      Zy)    Nc                  6    t         j                  j                  S )z1Return whether PyTorch is built with MKL support.)torch_Chas_mkl     N/var/www/html/venv/lib/python3.12/site-packages/torch/backends/mkl/__init__.pyis_availabler
      s    88r      c                   "    e Zd ZdZd Zd Zd Zy)verbosea?  
    On-demand oneMKL verbosing functionality.

    To make it easier to debug performance issues, oneMKL can dump verbose
    messages containing execution information like duration while executing
    the kernel. The verbosing functionality can be invoked via an environment
    variable named `MKL_VERBOSE`. However, this methodology dumps messages in
    all steps. Those are a large amount of verbose messages. Moreover, for
    investigating the performance issues, generally taking verbose messages
    for one single iteration is enough. This on-demand verbosing functionality
    makes it possible to control scope for verbose message dumping. In the
    following example, verbose messages will be dumped out for the second
    inference only.

    .. highlight:: python
    .. code-block:: python

        import torch
        model(data)
        with torch.backends.mkl.verbose(torch.backends.mkl.VERBOSE_ON):
            model(data)

    Args:
        level: Verbose level
            - ``VERBOSE_OFF``: Disable verbosing
            - ``VERBOSE_ON``:  Enable verbosing
    c                     || _         y )N)enable)selfr   s     r	   __init__zverbose.__init__+   s	    r   c                     | j                   t        k(  ry t        j                  j                  j                  | j                         }|sJ d       | S )NzSFailed to set MKL into verbose mode. Please consider to disable this verbose scope.)r   VERBOSE_OFFr   r   _verbosemkl_set_verbose)r   sts     r	   	__enter__zverbose.__enter__.   sI    ;;+%XX..t{{;	a`	ar   c                 ^    t         j                  j                  j                  t               y)NF)r   r   r   r   r   )r   exc_typeexc_valexc_tbs       r	   __exit__zverbose.__exit__7   s    ))+6r   N)__name__
__module____qualname____doc__r   r   r   r   r   r	   r   r      s    8r   r   )r   r
   r   
VERBOSE_ONr   r   r   r	   <module>r"      s#    
 
+ +r   