o
    wi                     @  sD   d dl mZ d dlZd dlmZ dejfddZG dd deZdS )	    )annotationsN)OpRunc                 C  s   t | }t|j}t |}|dk r||d 7 }|jd| }|j|| }dt| |j dt|  }	t ||	}
t t ||g |d|R }t j|
|k|dS )Nr      )r   )dtype)npasarraylenshapearangereshapemod)indicesdepthaxisr   valuesrankdepth_rangelsrs	new_shapetargets r   Z/home/ubuntu/sommelier/.venv/lib/python3.10/site-packages/onnx/reference/ops/op_one_hot.py_one_hot   s   


"r   c                   @  s   e Zd ZdddZdS )OneHotNc                 C  s0   |\}}t ||||jd}|||  | }|fS )N)r   r   )r   r   )selfr   r   r   r   	off_valueon_valueyr   r   r   _run   s   zOneHot._run)N)__name__
__module____qualname__r    r   r   r   r   r      s    r   )	
__future__r   numpyr   onnx.reference.op_runr   float32r   r   r   r   r   r   <module>   s
   