def test_embedder_scaling_overhead():
    """Tests that embedding to the 3rd layer of a 200 layer model takes less than double the time of embedding to.

    the same layer of a 3 layer model and therefore in the order of 10s - 100s of times faster than executing the full
    200 layer model.

    Note that this bound is intentionally high in an effort to reduce the flakiness of the test.

    """
    shallow_embedder = Embedder(NLayerModel(3), "backbone.2")

    start = time.perf_counter()
    shallow_embedder.predict_step(torch.rand(10, 1000), 0, 0)
    end = time.perf_counter()

    shallow_time = end - start

    deep_embedder = Embedder(NLayerModel(200), "backbone.2")

    start = time.perf_counter()
    deep_embedder.predict_step(torch.rand(10, 1000), 0, 0)
    end = time.perf_counter()

    deep_time = end - start

    diff_time = abs(deep_time - shallow_time)
    assert (diff_time / shallow_time) < 2
Tests that embedding to the 3rd layer of a 200 layer model takes less than double the time of embedding to.

    the same layer of a 3 layer model and therefore in the order of 10s - 100s of times faster than executing the full
    200 layer model.

    Note that this bound is intentionally high in an effort to reduce the flakiness of the test.

    
tests/core/utilities/test_embedder.py