def test_with_single_hidden_layer(self): layer = Layer(size=3, prev_size=2, activation=activation_functions.Sigmoid) biases = [-2, 0.5, 9] layer.set_biases(biases=np.array(biases, float)) self.assertEqual(layer.biases().tolist(), [-2, 0.5, 9])
def test_raises_exception_for_array_with_wrong_dimension(self): layer = Layer(size=5, prev_size=2, activation=activation_functions.Sigmoid) self.assertRaises(Layer.InvalidMatrixDimensions, lambda: layer.set_biases(biases=np.zeros((2, 2)))) self.assertRaises(Layer.InvalidMatrixDimensions, lambda: layer.set_biases(biases=np.zeros((4, 3))))