def test_lifecycle(self, modifier_lambda, model_lambda, optim_lambda, test_steps_per_epoch):
    modifier = modifier_lambda()
    model = model_lambda()
    optimizer = optim_lambda(model)
    self.initialize_helper(modifier, model)
    for epoch in range(int(modifier.start_epoch)):
        assert (not modifier.update_ready(epoch, test_steps_per_epoch))
    update_epochs = [modifier.start_epoch]
    if (modifier.disable_quantization_observer_epoch is not None):
        update_epochs.append(modifier.disable_quantization_observer_epoch)
    if (modifier.freeze_bn_stats_epoch is not None):
        update_epochs.append(modifier.freeze_bn_stats_epoch)
    for epoch in update_epochs:
        assert modifier.update_ready(epoch, test_steps_per_epoch)
    assert modifier.update_ready((modifier.start_epoch + 0.1), test_steps_per_epoch)
    if (modifier.start_epoch > 0):
        for module in model.modules():
            assert ((not hasattr(module, 'qconfig')) or (module.qconfig is None))
    else:
        _test_qat_applied(modifier, model)
    modifier.scheduled_update(model, optimizer, modifier.start_epoch, test_steps_per_epoch)
    if ((len(update_epochs) == 1) or (min(update_epochs[1:]) <= (modifier.start_epoch + 1))):
        for epoch_interval in range(10):
            epoch_interval *= 0.1
            epoch = (modifier.start_epoch + (0.1 * epoch_interval))
            assert (not modifier.update_ready(epoch, test_steps_per_epoch))
    _test_qat_applied(modifier, model)
def test_lifecycle(self, modifier_lambda, model_lambda, optim_lambda, test_steps_per_epoch):
    modifier = modifier_lambda()
    model = model_lambda()
    optimizer = optim_lambda(model)
    self.initialize_helper(modifier, model)
    for epoch in range(int(modifier.start_epoch)):
        assert (not modifier.update_ready(epoch, test_steps_per_epoch))
    update_epochs = [modifier.start_epoch]
    if (modifier.disable_quantization_observer_epoch is not None):
        update_epochs.append(modifier.disable_quantization_observer_epoch)
    if (modifier.freeze_bn_stats_epoch is not None):
        update_epochs.append(modifier.freeze_bn_stats_epoch)
    for epoch in update_epochs:
        assert modifier.update_ready(epoch, test_steps_per_epoch)
    assert modifier.update_ready((modifier.start_epoch + 0.1), test_steps_per_epoch)
    if (modifier.start_epoch > 0):
        for module in model.modules():
            assert ((not hasattr(module, 'qconfig')) or (module.qconfig is None))
    else:
        _test_qat_applied(modifier, model)
    modifier.scheduled_update(model, optimizer, modifier.start_epoch, test_steps_per_epoch)
    if ((len(update_epochs) == 1) or (min(update_epochs[1:]) <= (modifier.start_epoch + 1))):
        for epoch_interval in range(10):
            epoch_interval *= 0.1
            epoch = (modifier.start_epoch + (0.1 * epoch_interval))
            assert (not modifier.update_ready(epoch, test_steps_per_epoch))
    _test_qat_applied(modifier, model)