code: 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
  
file_path: lightning-flash/tests/core/utilities/test_embedder.py
imports: import time
  import pytest
  import torch
  from flash.core.utilities.embedder import Embedder
  from flash.core.utilities.imports import _TOPIC_CORE_AVAILABLE
  from pytorch_lightning import LightningModule
  from torch import nn
label_desc: Use image node_id 2 for calling a global function with example usage: test_embedder_scaling_overhead() without return types