<s> import numpy as np <EOL> import numpy . random as npr <EOL> import kayak <EOL> from . import * <EOL> def test_batchnorm_values_1 ( ) : <EOL> npr . seed ( <NUM_LIT:1> ) <EOL> for ii in xrange ( NUM_TRIALS ) : <EOL> np_X = npr . randn ( <NUM_LIT:5> , <NUM_LIT:4> ) <EOL> np_A = npr . randn ( <NUM_LIT:4> , <NUM_LIT:2> ) <EOL> A = kayak . Parameter ( np_A ) <EOL> X = kayak . Parameter ( np_X ) <EOL> Y = kayak . BatchNormalize ( X ) <EOL> J = kayak . TanH ( kayak . MatMult ( Y , A ) ) <EOL> Z = kayak . MatSum ( J ) <EOL> mu = np . mean ( np_X , axis = <NUM_LIT:0> , keepdims = True ) <EOL> sig = np . mean ( ( np_X - mu ) ** <NUM_LIT:2> , axis = <NUM_LIT:0> , keepdims = True ) + <NUM_LIT> <EOL> np_Y = ( np_X - mu ) / np . sqrt ( sig ) <EOL> assert np . all ( close_float ( Y . value , np_Y ) ) <EOL> assert kayak . util . checkgrad ( X , Z , verbose = True ) < MAX_GRAD_DIFF </s>
