o
    r::js                     @  s&   d dl mZ d dlZ	ddddZdS )    )annotationsNvalue
np.ndarrayshapetuple[int, ...]axisint
block_size
int | Nonereturnc                 C  s  t | jdkr	| S t | jdkr| jdkr| d S |sUt | jdks$J dgt | }z| j||< | t|W S  tyT } ztd| d| j d| d|d}~ww |dkr]tdtj| ||d	} || | j| kry| j	t
|| |d
} | j|krtdt|| j|ksJ | S )a  Reshape/Replicate scale/zero-point to be broadcastable to shape.

    Args:
        value: the array to be reshaped/replicated
        shape: the target shape
        axis: quantization axis, applicable for per-axis and blocked quantization
        block_size: size of quantization block, applicable only for blocked quantization

    Returns:
        value array after reshape/replicate according to quantization mode.
    r      zaxis is out of boundary, axis=z, value.shape=z, shape=.Nz&block_size must be a positive integer.)repeatsr   )indicesr   zInvalid shapes for Blocked Quantization. Input 2 shape should identical to Input 1 shape, except for one dimension, in which blocking is performed)lenr   sizereshapetuple
IndexError
ValueErrornprepeattakerangebroadcast_shapes)r   r   r   r	   dimse r   f/home/nk/hobo-godmode/plappi-mvp/.venv/lib/python3.10/site-packages/onnx/reference/ops/_quant_utils.pyreshape_input	   sB   

r   )N)
r   r   r   r   r   r   r	   r
   r   r   )
__future__r   numpyr   r   r   r   r   r   <module>   s   