def test_log_neg(): x = AD(-0.3, 1, 'x') with pytest.raises(ValueError): z = x.ln()
def test_log(): x = AD(0.5, 1, 'x') z = x.ln() assert z.val == [np.log(0.5)] assert z.der == [1 / 0.5]
def test_log_0(): x = AD(0, 1, 'x') with pytest.raises(ValueError): z = x.ln()