Пример #1
0
def test_print_op(capsys):
    x = tf.constant(0)
    utils.print_op(x, "hello")

    out, _ = capsys.readouterr()

    assert out == "hello 0\n"
Пример #2
0
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"
Пример #3
0
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"
Пример #4
0
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])
Пример #5
0
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])