justusschock: there is one test, that needs to be adapted, I will take care of this
diff --git a/ignite/engine/engine.py b/ignite/engine/engine.py
index e6131c4b..15a443fa 100644
--- a/ignite/engine/engine.py
+++ b/ignite/engine/engine.py
@@ -974,7 +974,7 @@ def _update_dataloader(dataloader, new_batch_sampler):
             params_keys.remove(k)
     params = {k: getattr(dataloader, k) for k in params_keys}
     params['batch_sampler'] = new_batch_sampler
-    return torch.utils.data.DataLoader(**params)
+    return type(dataloader)(**params)
 
 
 class ReproducibleBatchSampler(torch.utils.data.sampler.BatchSampler):
diff --git a/ignite/utils.py b/ignite/utils.py
index 1ea60149..381a500f 100644
--- a/ignite/utils.py
+++ b/ignite/utils.py
@@ -34,9 +34,9 @@ def apply_to_type(input_, input_type, func):
     elif isinstance(input_, (str, bytes)):
         return input_
     elif isinstance(input_, collections.Mapping):
-        return {k: apply_to_type(sample, input_type, func) for k, sample in input_.items()}
+        return type(input_)({k: apply_to_type(sample, input_type, func) for k, sample in input_.items()})
     elif isinstance(input_, collections.Sequence):
-        return [apply_to_type(sample, input_type, func) for sample in input_]
+        return type(input_)([apply_to_type(sample, input_type, func) for sample in input_])
     else:
         raise TypeError(("input must contain {}, dicts or lists; found {}"
                          .format(input_type, type(input_))))

Dynamic Typing
Sometimes there are types assumed and hardcoded, where it is not necessary.

For example there is [this part](https://github.com/pytorch/ignite/blob/master/ignite/engine/engine.py#L971) where we should infer the previous type of the data loader and re-use this. 
Other examples include type specific operations. E.g. we often check for mappings in general but then we only create dicts after doing some operations without restoring the original type. 

I will go through the core package and change this.
diff --git a/tests/ignite/test_utils.py b/tests/ignite/test_utils.py
index 155f96fd..db352774 100644
--- a/tests/ignite/test_utils.py
+++ b/tests/ignite/test_utils.py
@@ -19,12 +19,18 @@ def test_convert_tensor():
     tensor = convert_tensor(x, device='cpu', non_blocking=False)
     assert torch.is_tensor(tensor)
 
-    x = (torch.tensor([0.0]), torch.tensor([0.0]))
+    x = [torch.tensor([0.0]), torch.tensor([0.0])]
     list_ = convert_tensor(x)
     assert isinstance(list_, list)
     assert torch.is_tensor(list_[0])
     assert torch.is_tensor(list_[1])
 
+    x = (torch.tensor([0.0]), torch.tensor([0.0]))
+    tuple_ = convert_tensor(x)
+    assert isinstance(tuple_, tuple)
+    assert torch.is_tensor(tuple_[0])
+    assert torch.is_tensor(tuple_[1])
+
     x = {'a': torch.tensor([0.0]), 'b': torch.tensor([0.0])}
     dict_ = convert_tensor(x)
     assert isinstance(dict_, dict)

pip install -e .
parse_log_pytest
requirements.txt
pytest
apt-get update apt-get install -y gcc pip install torch torchvision -f https://download.pytorch.org/whl/cpu/torch_stable.html -U
3.7
requirements-dev.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
certifi @ file:///croot/certifi_1671487769961/work/certifi
charset-normalizer==3.4.1
exceptiongroup==1.2.2
idna==3.10
importlib-metadata==6.7.0
iniconfig==2.0.0
numpy==1.21.6
packaging==24.0
Pillow==9.5.0
pluggy==1.2.0
pytest==7.4.4
-e git+https://github.com/pytorch/ignite.git@ef698d966878346bd151f341c502a605dbccd07d#egg=pytorch_ignite
requests==2.31.0
tomli==2.0.1
torch==1.13.1+cpu
torchvision==0.14.1+cpu
typing_extensions==4.7.1
urllib3==2.0.7
zipp==3.15.0

name: ignite
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2022.12.7=py37h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - pip=22.3.1=py37h06a4308_0
  - python=3.7.16=h7a1cb2a_0
  - readline=8.2=h5eee18b_0
  - setuptools=65.6.3=py37h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.38.4=py37h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - charset-normalizer==3.4.1
      - exceptiongroup==1.2.2
      - idna==3.10
      - importlib-metadata==6.7.0
      - iniconfig==2.0.0
      - numpy==1.21.6
      - packaging==24.0
      - pillow==9.5.0
      - pluggy==1.2.0
      - pytest==7.4.4
      - requests==2.31.0
      - tomli==2.0.1
      - torch==1.13.1+cpu
      - torchvision==0.14.1+cpu
      - typing-extensions==4.7.1
      - urllib3==2.0.7
      - zipp==3.15.0
prefix: /opt/conda/envs/ignite

tests/ignite/test_utils.py::test_convert_tensor
tests/ignite/test_utils.py::test_to_onehot tests/ignite/test_utils.py::test_dist_setup_logger tests/ignite/test_utils.py::test_setup_logger
ignite/utils.py ignite/engine/engine.py
ignite/utils.py ignite/engine/engine.py