U
    <c/                     @   st   d dl Zd dlZd dlmZmZmZmZ dZdZ	e
dd eeeeeee	d D ZG dd	 d	eZdS )
    N)FuzzerFuzzedParameterParameterAliasFuzzedTensor   i   c                 c   s   | ]}d | V  qdS )   N .0ir   r   J/tmp/pip-unpacked-wheel-gikjz4vx/torch/utils/benchmark/op_fuzzers/unary.py	<genexpr>	   s     r      c                       s$   e Zd Zejdf fdd	Z  ZS )UnaryOpFuzzerFc                    s   t  jtddddddddd td	D d
d td	D dd td	D dd td	D tdddddgtdddddddd||d
g|d d S )NZdimg333333?g?)r   r      T)distributionstrictc                 S   s"   g | ]}t d | ttddqS )k_any_Z
loguniformnameminvalmaxvalr   )r   _MIN_DIM_SIZE_MAX_DIM_SIZEr	   r   r   r   
<listcomp>   s   z*UnaryOpFuzzer.__init__.<locals>.<listcomp>r   c                 S   s(   g | ] }t d | dd tD dqS )k_pow2_c                 S   s   i | ]}|d t t qS )g      ?)len_POW_TWO_SIZES)r
   sizer   r   r   
<dictcomp>)   s      z5UnaryOpFuzzer.__init__.<locals>.<listcomp>.<dictcomp>r   r   )r   r   r	   r   r   r   r   &   s
   c              	   S   s<   g | ]4}t d | td| dtd| diddqS )kr   皙?r   g?T)r   r   r   )r   r   r	   r   r   r   r   ,   s     c              
   S   s*   g | ]"}t d | dddddddqS )Zx_step_r"   gQ?g{Gz?)r   r         r   r    )r   r	   r   r   r   r   8   s
   Zrandom_valuer   l    uniformr   x)Zk0Zk1Zk2)Zx_step_0Zx_step_1Zx_step_2g      ?i   i   l        )
r   r   ZstepsZprobability_contiguousZmin_elementsZmax_elementsZmax_allocation_bytesZdim_parameterdtypecuda)
parametersZtensorsseed)super__init__r   ranger   )selfr*   r'   r(   	__class__r   r   r,      s>    
1zUnaryOpFuzzer.__init__)__name__
__module____qualname__torchZfloat32r,   __classcell__r   r   r/   r   r      s   r   )Znumpynpr4   Ztorch.utils.benchmarkr   r   r   r   r   r   tupler-   intlog2r   r   r   r   r   r   <module>   s   

