Esempio n. 1
0
 def test_with_get_output_kw(self, objective, get_output):
     loss_function, target = Mock(), Mock()
     loss_function.return_value = np.array([1, 2, 3])
     objective(
         [1, 2, 3], loss_function=loss_function, target=target,
         get_output_kw={'i_was': 'here'},
         )
     get_output.assert_called_with(3, deterministic=False, i_was='here')
Esempio n. 2
0
 def test_with_get_output_kw(self, objective, get_output):
     loss_function, target = Mock(), Mock()
     loss_function.return_value = np.array([1, 2, 3])
     objective(
         [1, 2, 3], loss_function=loss_function, target=target,
         get_output_kw={'i_was': 'here'},
         )
     get_output.assert_called_with(3, deterministic=False, i_was='here')
Esempio n. 3
0
 def test_with_defaults(self, objective, get_output):
     loss_function, target = Mock(), Mock()
     loss_function.return_value = np.array([1, 2, 3])
     result = objective(
         [1, 2, 3], loss_function=loss_function, target=target)
     assert result == 2.0
     get_output.assert_called_with(3, deterministic=False)
     loss_function.assert_called_with(get_output.return_value, target)
Esempio n. 4
0
 def test_with_defaults(self, objective, get_output):
     loss_function, target = Mock(), Mock()
     loss_function.return_value = np.array([1, 2, 3])
     result = objective(
         [1, 2, 3], loss_function=loss_function, target=target)
     assert result == 2.0
     get_output.assert_called_with(3, deterministic=False)
     loss_function.assert_called_with(get_output.return_value, target)