<s> import numpy <EOL> from theano import tensor <EOL> from blocks . bricks import Linear <EOL> from blocks . initialization import Constant , IsotropicGaussian <EOL> def test_linearlike_subclass_initialize_works_overridden_w ( ) : <EOL> class NotQuiteLinear ( Linear ) : <EOL> @ property <EOL> def W ( self ) : <EOL> W = super ( NotQuiteLinear , self ) . W <EOL> return W / tensor . sqrt ( ( W ** <NUM_LIT:2> ) . sum ( axis = <NUM_LIT:0> ) ) <EOL> brick = NotQuiteLinear ( <NUM_LIT:5> , <NUM_LIT:10> , weights_init = IsotropicGaussian ( <NUM_LIT> ) , <EOL> biases_init = Constant ( <NUM_LIT:1> ) ) <EOL> brick . initialize ( ) <EOL> assert not numpy . isnan ( brick . parameters [ <NUM_LIT:0> ] . get_value ( ) ) . any ( ) <EOL> numpy . testing . assert_allclose ( ( brick . W ** <NUM_LIT:2> ) . sum ( axis = <NUM_LIT:0> ) . eval ( ) , <NUM_LIT:1> , <EOL> rtol = <NUM_LIT> ) </s>
