U
    rh^                     @  sP   d dl mZ d dlZd dlZd dlmZ d dlmZ dd Z	G dd deZ
dS )	    )annotationsN)Base)expectc                 C  s   t jjd| d|S )N   )p)nprandomZbinomialastype)xdtype r   I/tmp/pip-unpacked-wheel-xnis5xre/onnx/backend/test/case/node/bernoulli.py"bernoulli_reference_implementation   s    r   c                   @  sB   e Zd ZeddddZeddddZeddddZd	S )
	BernoulliNone)returnc                  C  sN   t jjddgdgd} tjdddt}t|t}t	| |g|gdd	 d S )
Nr   r
   y)inputsoutputs              ?
   Ztest_bernoullir   r   name)
onnxhelper	make_noder   r   uniformr	   floatr   r   noder
   r   r   r   r   export_bernoulli_without_dtype   s    
z(Bernoulli.export_bernoulli_without_dtypec                  C  sV   t jjddgdgt jjd} tjdddtj	}t
|t}t| |g|gdd	 d S )
Nr   r
   r   )r   r   r   r   r   r   Ztest_bernoulli_doubler   )r   r   r   ZTensorProtoZDOUBLEr   r   r   r	   float32r   r   r   r   r   r   r   export_bernoulli_with_dtype"   s    
z%Bernoulli.export_bernoulli_with_dtypec                  C  s\   t d} tjjddgdg| d}tjdddtj}t	|tj}t
||g|gd	d
 d S )Nr   r   r
   r   )r   r   seedr   r   r   Ztest_bernoulli_seedr   )r   r   r   r   r   r   r   r	   r"   r   r   )r$   r    r
   r   r   r   r   export_bernoulli_with_seed/   s    z$Bernoulli.export_bernoulli_with_seedN)__name__
__module____qualname__staticmethodr!   r#   r%   r   r   r   r   r      s   r   )
__future__r   Znumpyr   r   Zonnx.backend.test.case.baser   Zonnx.backend.test.case.noder   r   r   r   r   r   r   <module>   s   