def test_print_op(capsys): x = tf.constant(0) utils.print_op(x, "hello") out, _ = capsys.readouterr() assert out == "hello 0\n"
def test_print_op(capsys, sess): x = tf.constant(0) y = utils.print_op(x, "hello") z = y + 0 sess.run(z) out, _ = capsys.readouterr() assert out == "hello 0\n"
def test_find_non_differentiable(): x = tf.constant(0) y = utils.print_op(x, "test") z = y + 1 with pytest.raises(SimulationError): utils.find_non_differentiable([x], [z]) x = tf.constant(0) y = x * 2 z = y + 1 utils.find_non_differentiable([x], [z])