#NEWLINE# def test_bias( backend_cpu64 , biasargs ) : #NEWLINE# #INDENT# ( n , batch_size ) = biasargs #NEWLINE# NervanaObject . be . bsz = NervanaObject . be . batch_size = batch_size #NEWLINE# init = Gaussian ( ) #NEWLINE# layer = BiasWithReset ( init = init ) #NEWLINE# inp = np . random . randn ( n , batch_size ) #NEWLINE# epsilon = 1e-05 #NEWLINE# pert_frac = 0.1 #NEWLINE# pert_cnt = int ( np . ceil ( ( inp . size * pert_frac ) ) ) #NEWLINE# pert_inds = np . random . permutation ( inp . size ) [ 0 : pert_cnt ] #NEWLINE# ( max_abs , max_rel ) = general_gradient_comp ( layer , inp , epsilon = epsilon , lshape = inp . shape , pert_inds = pert_inds ) #NEWLINE# assert ( max_abs < 1e-07 )