U
    d
                     @   s`   d dl Zd dlmZ d dlmZ d dlmZ d dl	m
Z
 d dlm  mZ G dd dejZdS )    N)
coo_matrix)given)corec                   @   sn   e Zd Zef ejdddejdddejdddejdddejdddejd	d
ddejdd Z	dS )TestFunHash      )Z	min_valueZ	max_value
               g?g      ?)n_outn_inn_datan_weightn_alphasparsityc	              	   C   sP  t j||}	d|	|	|k< t|	}
|
j|
j|
j  }}}t j|t j}t j|t j}|t j}|t j	}|t j
}tjddddddgdg|d	}| |||||||gdg | |||||||gd
dg | |||||||gddg tjdddddgdg|d	}| ||||||gdg | ||||||gd
dg d S )Nr   ZFunHashvalkeysegweightalphaout)Znum_outputsr      )nprandomZrandr   datacolrowZastypeZfloat32Zint64Zint32r   ZCreateOperatorZassertDeviceChecksZassertGradientChecks)selfr   r   r   r   r   r   gcdcAZA_coor   r   r   r   r   opZop2 r$   M/tmp/pip-unpacked-wheel-ua33x9lu/caffe2/experiments/python/funhash_op_test.pytest_funhash    sl    	           
  
   
  zTestFunHash.test_funhashN)
__name__
__module____qualname__r   stZintegersZfloatshuZgcsr&   r$   r$   r$   r%   r      s   r   )Znumpyr   Zscipy.sparser   Z
hypothesisr   Zhypothesis.strategiesZ
strategiesr*   Zcaffe2.pythonr   Z"caffe2.python.hypothesis_test_utilpythonZhypothesis_test_utilr+   ZHypothesisTestCaser   r$   r$   r$   r%   <module>   s   