def test_grad_test_values(self):
"""
Regression test for test values of `ifelse` gradient.
"""
backup = theano.config.compute_test_value
theano.config.compute_test_value = 'raise'
try:
x = tensor.scalar('x')
x.tag.test_value = 1
# Used to crash due to undefined test value.
tensor.grad(ifelse(0, x, x), x)
finally:
theano.config.compute_test_value = backup
评论列表
文章目录