
    bIg                    Z    d dl mZ d dlZd dlmZ dej                  fdZ G d de      Zy)    )annotationsN)OpRunc                   t        j                  |       }t        |j                        }t        j                  |      }|dk  r||dz   z  }|j                  d| }|j                  || }dt        |      z  |j                  z   dt        |      z  z   }	t        j
                  ||	      }
t        j
                  t        j                  ||      g |d|      }t        j                  |
|k(  |      S )Nr      )r   )dtype)npasarraylenshapearangereshapemod)indicesdepthaxisr   valuesrankdepth_rangelsrs	new_shapetargetss              Z/var/www/html/answerous/venv/lib/python3.12/site-packages/onnx/reference/ops/op_one_hot.py_one_hotr      s    ZZ Fv||D))E"Kaxq	a	B	d4	 Bs2w!2!22TCG^CIjji0GZZvu-}}Q}}=F::g'u55    c                      e Zd ZddZy)OneHotNc                Z    |\  }}t        ||||j                        }|||z
  z  |z   }|fS )N)r   r   )r   r   )selfr   r   r   r   	off_valueon_valueys           r   _runzOneHot._run   s;    $	8We$fllCI%&2tr   )N)__name__
__module____qualname__r$    r   r   r   r      s    r   r   )	
__future__r   numpyr	   onnx.reference.op_runr   float32r   r   r(   r   r   <module>r-      s,    #  ' #%BJJ 6U r   