def test_spatial_batch_normalization():
 def check(*input_dim):
  sbn = SpatialBatchNormalization(input_dim)
  sbn.initialize()
  x = theano.tensor.TensorType(theano.config.floatX, ([False] * (len(input_dim) + 1)))()
  y = sbn.apply(x)
  rng = numpy.random.RandomState((2015, 12, 17))
  input_ = random_unif(rng, ((11,) + input_dim))
  assert_equal(y.eval({x: input_}), input_)
 (yield (check, 2, 3, 5))
 (yield (check, 5, 3, 2, 3))
 (yield (check, 1, 11))

def test_spatial_batch_normalization ( ) : def check ( * input_dim ) : sbn = SpatialBatchNormalization ( input_dim ) sbn . initialize ( ) x = theano . tensor . TensorType ( theano . config . floatX , ( [ False ] * ( len ( input_dim ) + 1 ) ) ) ( ) y = sbn . apply ( x ) rng = numpy . random . RandomState ( ( 2015 , 12 , 17 ) ) input_ = random_unif ( rng , ( ( 11 , ) + input_dim ) ) assert_equal ( y . eval ( { x : input_ } ) , input_ ) ( yield ( check , 2 , 3 , 5 ) ) ( yield ( check , 5 , 3 , 2 , 3 ) ) ( yield ( check , 1 , 11 ) )
smoke test for spatialbatchnormalization .