def test_backprop_121(): print('\n=== test_backprop_121 ===') _nn_like.bias(0) _nn_like.nn_like([1, 2, 1]) _nn_like.fixed_weights(1.2, 1.0) o_before = _nn_like.forward_deterministic([1])[0] _nn_like.backprop_deterministic([o_before], [0.6], 1.0) o_after = _nn_like.forward_deterministic([1])[0] print(o_before, o_after) assert 0.55 < o_after < 0.65
def test_backprop_111_neg_input(): print('\n=== test_backprop_111_neg_input ===') _nn_like.bias(0) _nn_like.nn_like([1, 1, 1]) _nn_like.fixed_weights(1.2, 1.0) o_before = _nn_like.forward_deterministic([-2])[0] _nn_like.backprop_deterministic([o_before], [-0.6], 1.0) o_after = _nn_like.forward_deterministic([-2])[0] print(o_before, o_after) assert -0.65 < o_after < 0.55