def test_torch_nn_loss() : trainer = DefaultTrainer( optimizer=optimizer, scheduler=scheduler, model=model, criterion=loss_fn, experiment_logger=experiment_logger )
def test_construct_from_dict(): trainer = DefaultTrainer( optimizer=optimizer, scheduler=scheduler, model=model, criterion=loss_fn, experiment_logger=experiment_logger )
def test_construct_from_tuple() : model = DummyModel() loss_fn = DummyLossFN() trainer = DefaultTrainer( optimizer=optimizer, scheduler=scheduler, model=model, criterion=loss_fn, experiment_logger=experiment_logger )
def test_broken_construct_from_tuple_2() : with pytest.warns(UserWarning) as e: ## default trainer only warns loss_fn = BrokenDummyLossFN() trainer = DefaultTrainer( optimizer=optimizer, scheduler=scheduler, model=model, criterion=loss_fn, experiment_logger=experiment_logger ) with pytest.raises(TypeError) as e: ## using strict trainer raises type error loss_fn = BrokenDummyLossFN() trainer = StrictCustomTrainer( optimizer=optimizer, scheduler=scheduler, model=model, criterion=loss_fn, experiment_logger=experiment_logger )