code: def test_ensemble(self) -> None:
      with skip_if_downloading_fails():
          bundle_generator = BundleGen(
              algo_path=self.work_dir,
              data_stats_filename=self.da_output_yaml,
              data_src_cfg_name=self.data_src_cfg_name,
              templates_path_or_url=get_testing_algo_template_path(),
          )
      bundle_generator.generate(self.work_dir, num_fold=1)
      history = bundle_generator.get_history()
  
      for algo_dict in history:
          name = algo_dict[AlgoKeys.ID]
          algo = algo_dict[AlgoKeys.ALGO]
          _train_param = train_param.copy()
          if name.startswith("segresnet"):
              _train_param["network#init_filters"] = 8
              _train_param["pretrained_ckpt_name"] = ""
          elif name.startswith("swinunetr"):
              _train_param["network#feature_size"] = 12
          algo.train(_train_param)
  
      builder = AlgoEnsembleBuilder(
          history, data_src_cfg_name=self.data_src_cfg_name
      )
      builder.set_ensemble_method(AlgoEnsembleBestN(n_best=1))
      ensemble = builder.get_ensemble()
      preds = ensemble(pred_param)
      self.assertTupleEqual(preds[0].shape, (2, 24, 24, 24))
  
      builder.set_ensemble_method(AlgoEnsembleBestByFold(1))
      ensemble = builder.get_ensemble()
      for algo in ensemble.get_algo_ensemble():
          print(algo[AlgoKeys.ID])
  
imports: from __future__ import annotations
  import os
  import tempfile
  import unittest
  import nibabel
  import numpy
  import torch
  from monai.apps.auto3dseg import AlgoEnsembleBestByFold, AlgoEnsembleBestN, AlgoEnsembleBuilder, BundleGen, DataAnalyzer, EnsembleRunner
  from monai.bundle.config_parser import ConfigParser
  from monai.data import create_test_image_3d
  from monai.transforms import SaveImage
  from monai.utils import check_parent_dir, optional_import, set_determinism
  from monai.utils.enums import AlgoKeys
  from tests.utils import SkipIfBeforePyTorchVersion, get_testing_algo_template_path, skip_if_downloading_fails, skip_if_no_cuda, skip_if_quick
label_desc: Use image node_id 2 for calling the TestEnsembleBuilder obj's underlying member method code with example usage: obj.test_ensemble() without return types