def test_SameInputLayer(): layer = mh.SameInputLayer(_pca_nodes([10, 10, 10], [5, 3, 1])) x = numx_rand.random([100, 10]).astype('f') layer.train(x) y = layer.execute(x) assert layer.dtype == numx.dtype('f') assert y.dtype == layer.dtype
def testRect2d_get_out_channel_node(): sboard = mh.Rectangular2dSwitchboard(in_channels_xy=(5, 4), in_channel_dim=2, field_channels_xy=(3, 2), field_spacing_xy=(1, 2)) x = numx.array( [range(0, sboard.input_dim), range(101, 101 + sboard.input_dim)]) y = sboard.execute(x) # routing layer nodes = [ sboard.get_out_channel_node(index) for index in xrange(sboard.output_channels) ] layer = mh.SameInputLayer(nodes) layer_y = layer.execute(x) assert (y == layer_y).all()