Пример #1
0
 def test_nmf_reshape_activations_2(self):
     batch, layers, neurons, position = 2, 6, 128, 10
     activations = np.ones((batch, layers, neurons, position))
     merged_activations = NMF.reshape_activations(activations,
                                                  None, None, None)
     assert merged_activations.shape == (layers*neurons, batch*position)
Пример #2
0
 def test_nmf_raises_value_error_same_layer(self):
     with pytest.raises(ValueError, match=r".* same value.*") as ex:
         NMF(np.zeros((1, 1, 1, 1)),
             n_components=2,
             from_layer=0,
             to_layer=0)
Пример #3
0
 def test_nmf_raises_value_error_layer_bounds(self):
     with pytest.raises(ValueError, match=r".* larger.*"):
         NMF(np.zeros((1, 1, 1, 1)),
             n_components=2,
             from_layer=1,
             to_layer=0)
Пример #4
0
 def test_nmf_raises_activations_dimension_value_error(self):
     with pytest.raises(ValueError, match=r".* four dimensions.*") as ex:
         NMF(np.zeros(0),
             n_components=2)