class_docstr: Customized prepare batch callable for trainers or evaluators which support extra input data for the network.
  Extra items are specified by the `extra_keys` parameter and are extracted from the input dictionary (ie. the batch).
  This uses `default_prepare_batch` but requires dictionary inputs.
  
  Args:
      extra_keys: If a string or sequence of strings is provided, values from the input dictionary are extracted from
          those keys and passed to the network as extra positional arguments. If a dictionary is provided, every pair
          `(k, v)` in that dictionary will become a new keyword argument assigning to `k` the value in the input
          dictionary keyed to `v`.
class_docstr_tok: ["Customized","prepare","batch","callable","for","trainers","or","evaluators","which","support","extra","input","data","for","the","network",".","Extra","items","are","specified","by","the","`","extra_keys","`","parameter","and","are","extracted","from","the","input","dictionary","(","ie",".","the","batch",")",".","This","uses","`","default_prepare_batch","`","but","requires","dictionary","inputs",".","Args",":","extra_keys",":","If","a","string","or","sequence","of","strings","is","provided",",","values","from","the","input","dictionary","are","extracted","from","those","keys","and","passed","to","the","network","as","extra","positional","arguments",".","If","a","dictionary","is","provided",",","every","pair","`","(","k",",","v",")","`","in","that","dictionary","will","become","a","new","keyword","argument","assigning","to","`","k","`","the","value","in","the","input","dictionary","keyed","to","`","v","`","."]
docstr: Args `batchdata`, `device`, `non_blocking` refer to the ignite API:
  https://pytorch.org/ignite/v0.4.8/generated/ignite.engine.create_supervised_trainer.html.
  `kwargs` supports other args for `Tensor.to()` API.
docstr_tok: ["Args","`","batchdata","`",",","`","device","`",",","`","non_blocking","`","refer","to","the","ignite","API",":","https",":","\/\/pytorch.org\/ignite\/v0.4.8\/generated\/ignite.engine.create_supervised_trainer.html",".","`","kwargs","`","supports","other","args","for","`","Tensor.to","(",")","`","API","."]
code: def __call__(
      self,
      batchdata: dict[str, torch.Tensor],
      device: str | torch.device | None = None,
      non_blocking: bool = False,
      **kwargs: Any,
  ) -> tuple[torch.Tensor, torch.Tensor, tuple, dict]:
      """
      Args `batchdata`, `device`, `non_blocking` refer to the ignite API:
      https://pytorch.org/ignite/v0.4.8/generated/ignite.engine.create_supervised_trainer.html.
      `kwargs` supports other args for `Tensor.to()` API.
      """
      image, label = default_prepare_batch(
          batchdata, device, non_blocking, **kwargs
      )
      args_ = list()
      kwargs_ = dict()
  
      def _get_data(key: str) -> torch.Tensor:
          data = batchdata[key]
  
          if isinstance(data, torch.Tensor):
              data = data.to(
                  device=device, non_blocking=non_blocking, **kwargs
              )
  
          return data
  
      if isinstance(self.extra_keys, (str, list, tuple)):
          for k in ensure_tuple(self.extra_keys):
              args_.append(_get_data(k))
      elif isinstance(self.extra_keys, dict):
          for k, v in self.extra_keys.items():
              kwargs_.update({k: _get_data(v)})
  
      return (
          cast(torch.Tensor, image),
          cast(torch.Tensor, label),
          tuple(args_),
          kwargs_,
      )
  
imports: from __future__ import annotations
  from abc import ABC, abstractmethod
  from collections.abc import Callable, Sequence
  from typing import TYPE_CHECKING, Any, cast
  import torch
  from monai.config import IgniteInfo
  from monai.transforms import apply_transform
  from monai.utils import ensure_tuple, min_version, optional_import
  from monai.utils.enums import CommonKeys, GanKeys
label_desc: Use image node_id 2 for calling the PrepareBatchExtraInput obj's underlying member method code with example usage: obj.__call__(batchdata, device, non_blocking) and returns: cast,  cast,  tuple,  kwargs_, data