def check_gaussian_samples(value, nsamples, nvis, rows, cols, channels, expected_mean, tol):
 if nvis:
  expected_shape = (nsamples, nvis)
 else:
  expected_shape = (nsamples, rows, cols, channels)
 assert (value.shape == expected_shape)
 assert (not is_binary(value))
 mean = value.mean(axis=0)
 max_error = np.abs((mean - expected_mean)).max()
 print('Actual mean:')
 print(mean)
 print('Expected mean:')
 print(expected_mean)
 print('Maximal error:', max_error)
 print('Tolerable variance:', tol)
 if (max_error > tol):
  raise ValueError("Samples don't seem to have the right mean.")
 else:
  print('Mean is within expected range')

def check_gaussian_samples ( value , nsamples , nvis , rows , cols , channels , expected_mean , tol ) : if nvis : expected_shape = ( nsamples , nvis ) else : expected_shape = ( nsamples , rows , cols , channels ) assert ( value . shape == expected_shape ) assert ( not is_binary ( value ) ) mean = value . mean ( axis = 0 ) max_error = np . abs ( ( mean - expected_mean ) ) . max ( ) print ( 'Actual mean:' ) print ( mean ) print ( 'Expected mean:' ) print ( expected_mean ) print ( 'Maximal error:' , max_error ) print ( 'Tolerable variance:' , tol ) if ( max_error > tol ) : raise ValueError ( "Samples don't seem to have the right mean." ) else : print ( 'Mean is within expected range' )
tests that a matrix of gaussian samples 1) has the right shape 2) is not binary 3) converges to the right mean .