def test_affine_wrapper(backend_default):
 nout = 11
 aff = Affine(nout, Uniform())
 assert isinstance(aff, list)
 assert (len(aff) == 1)
 assert isinstance(aff[0], Linear)
 assert (aff[0].nout == nout)
 aff = Affine(nout, Uniform(), bias=Uniform())
 assert isinstance(aff, list)
 assert (len(aff) == 2)
 assert isinstance(aff[0], Linear)
 assert isinstance(aff[1], Bias)
 aff = Affine(nout, Uniform(), activation=Rectlin())
 assert isinstance(aff, list)
 assert (len(aff) == 2)
 assert isinstance(aff[0], Linear)
 assert isinstance(aff[1], Activation)
 aff = Affine(nout, Uniform(), bias=Uniform(), activation=Rectlin())
 assert isinstance(aff, list)
 assert (len(aff) == 3)
 assert isinstance(aff[0], Linear)
 assert isinstance(aff[1], Bias)
 assert isinstance(aff[2], Activation)

def test_affine_wrapper ( backend_default ) : nout = 11 aff = Affine ( nout , Uniform ( ) ) assert isinstance ( aff , list ) assert ( len ( aff ) == 1 ) assert isinstance ( aff [ 0 ] , Linear ) assert ( aff [ 0 ] . nout == nout ) aff = Affine ( nout , Uniform ( ) , bias = Uniform ( ) ) assert isinstance ( aff , list ) assert ( len ( aff ) == 2 ) assert isinstance ( aff [ 0 ] , Linear ) assert isinstance ( aff [ 1 ] , Bias ) aff = Affine ( nout , Uniform ( ) , activation = Rectlin ( ) ) assert isinstance ( aff , list ) assert ( len ( aff ) == 2 ) assert isinstance ( aff [ 0 ] , Linear ) assert isinstance ( aff [ 1 ] , Activation ) aff = Affine ( nout , Uniform ( ) , bias = Uniform ( ) , activation = Rectlin ( ) ) assert isinstance ( aff , list ) assert ( len ( aff ) == 3 ) assert isinstance ( aff [ 0 ] , Linear ) assert isinstance ( aff [ 1 ] , Bias ) assert isinstance ( aff [ 2 ] , Activation )
verify that the affine wrapper constructs the right layer objects .