def test_loop_with_initialized_model(self):
    """Check that loop does not re-initialize an already initialized model."""
    model = tl.Serial(tl.Dense(1))
    example_data = next(_very_simple_data())
    model.init(example_data)
    w = model.weights[0][0]
    task = training.TrainTask(
        _very_simple_data(), tl.L2Loss(), optimizers.SGD(.01))
    eval_task = training.EvalTask(
        _very_simple_data(),  # deliberately re-using training data
        [tl.L2Loss()],
        metric_names=['SGD.L2Loss'])
    loop = training.Loop(model, [task], eval_tasks=[eval_task],
                         eval_at=lambda step_n: step_n % 2 == 0)
    self.assertEqual(0, loop.step)
    self.assertEqual(loop.model.weights[0][0], w)
Check that loop does not re-initialize an already initialized model.
trax/supervised/training_test.py