code: def test_collect_activations(tmpdir, csv_filename):
      output_dir = None
      try:
          model, output_dir = _train(*_prepare_data(csv_filename))
          model_path = os.path.join(output_dir, "model")
  
          # [last_hidden, logits, projection_input]
          filenames = _collect_activations(
              model_path,
              [name for name, _ in model.model.named_children()],
              csv_filename,
              tmpdir,
          )
          assert len(filenames) == 3
      finally:
          if output_dir:
              shutil.rmtree(output_dir, ignore_errors=True)
  
file_path: ludwig/tests/integration_tests/test_collect.py
imports: import os
  import shutil
  import numpy
  import torch
  from ludwig.api import LudwigModel
  from ludwig.collect import collect_activations, collect_weights, print_model_summary
  from ludwig.constants import BATCH_SIZE, ENCODER, TRAINER, TYPE
  from ludwig.utils.torch_utils import get_torch_device
  from tests.integration_tests.utils import category_feature, ENCODERS, generate_data, sequence_feature
label_desc: Use image node_id 6 for calling a global function with example usage: test_collect_activations(tmpdir, csv_filename) without return types