Esempio n. 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
Esempio n. 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
Esempio n. 3
0
 def train_func():
     for i in range(2):
         report(loss=i)
Esempio n. 4
0
 def train_2():
     for i in range(2):
         report(loss=i)
     train_1()
Esempio n. 5
0
 def train_func():
     save_checkpoint(epoch=0)
     report(epoch=1)
Esempio n. 6
0
 def train_func():
     for i in range(2):
         report(i)
     return 1