code: def _test_captum(
      model_config_class,
      model_config_params,
      data_config,
      train,
      test,
      attr_method,
      single_row,
      baselines,
  ):
      model_config = model_config_class(**model_config_params)
      trainer_config = TrainerConfig(
          max_epochs=3,
          checkpoints=None,
          early_stopping=None,
          accelerator="cpu",
          fast_dev_run=True,
      )
      optimizer_config = OptimizerConfig()
  
      tabular_model = TabularModel(
          data_config=data_config,
          model_config=model_config,
          optimizer_config=optimizer_config,
          trainer_config=trainer_config,
      )
      tabular_model.fit(
          train=train,
          validation=test,
      )
      if single_row:
          test = test.head(1)
      else:
          test = test.head(10)
  
      is_full_baselines = attr_method in [
          "GradientShap",
          "DeepLiftShap",
      ]
      is_not_supported = tabular_model.model._get_name() in [
          "TabNetModel",
          "MDNModel",
          "TabTransformerModel",
      ]
      if is_full_baselines and (
          baselines is None or isinstance(baselines, (float, int))
      ):
          with pytest.raises(ValueError):
              exp = tabular_model.explain(
                  test, method=attr_method, baselines=baselines
              )
          return
      elif is_not_supported:
          with pytest.raises((NotImplementedError, AssertionError)):
              exp = tabular_model.explain(
                  test, method=attr_method, baselines=baselines
              )
          return
      elif (
          attr_method in ["FeaturePermutation", "FeatureAblation"]
          and single_row
      ):
          with pytest.raises(AssertionError):
              exp = tabular_model.explain(
                  test, method=attr_method, baselines=baselines
              )
          return
      else:
          exp = tabular_model.explain(
              test, method=attr_method, baselines=baselines
          )
      assert (
          exp.shape[1]
          == tabular_model.model.hparams.continuous_dim
          + tabular_model.model.hparams.categorical_dim
      )
  
imports: import copy
  import os
  import numpy
  import pytest
  import torch
  from pytorch_tabular import TabularModel, TabularModelTuner, model_sweep
  from pytorch_tabular.config import DataConfig, OptimizerConfig, TrainerConfig
  from pytorch_tabular.config.config import SSLModelConfig
  from pytorch_tabular.feature_extractor import DeepFeatureExtractor
  from pytorch_tabular.models import AutoIntConfig, CategoryEmbeddingModelConfig, FTTransformerConfig, GANDALFConfig, GatedAdditiveTreeEnsembleConfig, NodeConfig, TabNetModelConfig
  from pytorch_tabular.ssl_models import DenoisingAutoEncoderConfig
  from scipy.stats import randint, uniform
  from sklearn.metrics import accuracy_score, r2_score
  from sklearn.model_selection import KFold
label_desc: Use image node_id 8 for calling a global function with example usage: _test_captum(model_config_class, model_config_params, data_config, train, test, attr_method, single_row, baselines) without return types