示例#1
0
def test_report_after_finish(session):
    session.start()
    session.pause_reporting()
    session.finish()
    for _ in range(2):
        report(loss=1)
    assert session.get_next() is None
示例#2
0
def test_warn_once():
    """Checks if session misuse warning is only shown once per function."""

    with pytest.warns(UserWarning) as record:
        assert not load_checkpoint()
        assert not load_checkpoint()
        assert not save_checkpoint(x=2)
        assert not report(x=2)
        assert not report(x=3)
        assert not get_dataset_shard()

    # Should only warn once.
    assert len(record) == 4
示例#3
0
 def train_func():
     for i in range(2):
         report(loss=i)
示例#4
0
 def train_2():
     for i in range(2):
         report(loss=i)
     train_1()
示例#5
0
 def train_func():
     save_checkpoint(epoch=0)
     report(epoch=1)
示例#6
0
 def train_func():
     for i in range(2):
         report(i)
     return 1