Fix-crash in scan grad when compute_test_value=raise

fix gh-1385