예제 #1
0
 def test_broadcast(self, input_data, input_var, input_layer):
     from lasagne.layers.shape import DimshuffleLayer
     ds = DimshuffleLayer(input_layer, [0, 1, 2, 3, 4, 'x'])
     assert ds.output_shape == (2, 3, 1, 5, 7, 1)
     assert ds.get_output_for(input_var).eval({
         input_var: input_data
     }).shape == (2, 3, 1, 5, 7, 1)
예제 #2
0
 def test_rearrange(self, input_data, input_var, input_layer):
     from lasagne.layers.shape import DimshuffleLayer
     ds = DimshuffleLayer(input_layer, [4, 3, 2, 1, 0])
     assert ds.output_shape == (7, 5, 1, 3, 2)
     assert ds.get_output_for(input_var).eval({
         input_var: input_data
     }).shape == (7, 5, 1, 3, 2)
예제 #3
0
 def test_collapse_None(self, input_data, input_var, input_layer_with_None):
     from lasagne.layers.shape import DimshuffleLayer
     ds_ok = DimshuffleLayer(input_layer_with_None, [0, 1, 3, 4])
     assert ds_ok.output_shape == (2, 3, 5, 7)
     assert ds_ok.get_output_for(input_var).eval(
         {input_var: input_data}).shape == (2, 3, 5, 7)
     with pytest.raises(ValueError):
         DimshuffleLayer(input_layer_with_None, [0, 1, 2, 4])
예제 #4
0
 def test_collapse_None(self, input_data, input_var, input_layer_with_None):
     from lasagne.layers.shape import DimshuffleLayer
     ds_ok = DimshuffleLayer(input_layer_with_None, [0, 1, 3, 4])
     assert ds_ok.output_shape == (2, 3, 5, 7)
     assert ds_ok.get_output_for(input_var).eval(
         {input_var: input_data}).shape == (2, 3, 5, 7)
     with pytest.raises(ValueError):
         DimshuffleLayer(input_layer_with_None, [0, 1, 2, 4])
예제 #5
0
 def test_broadcast(self, input_data, input_var, input_layer):
     from lasagne.layers.shape import DimshuffleLayer
     ds = DimshuffleLayer(input_layer, [0, 1, 2, 3, 4, 'x'])
     assert ds.output_shape == (2, 3, 1, 5, 7, 1)
     assert ds.get_output_for(input_var).eval(
         {input_var: input_data}).shape == (2, 3, 1, 5, 7, 1)
예제 #6
0
 def test_rearrange(self, input_data, input_var, input_layer):
     from lasagne.layers.shape import DimshuffleLayer
     ds = DimshuffleLayer(input_layer, [4, 3, 2, 1, 0])
     assert ds.output_shape == (7, 5, 1, 3, 2)
     assert ds.get_output_for(input_var).eval(
         {input_var: input_data}).shape == (7, 5, 1, 3, 2)