class_docstr: Serializable class that applies a transform to a key specified field in samples.
class_docstr_tok: ["Serializable","class","that","applies","a","transform","to","a","key","specified","field","in","samples","."]
docstr: Updates sample by applying a transform to the value at the specified key.
  
  Args:
      sample: input sample which will be transformed
docstr_tok: ["Updates","sample","by","applying","a","transform","to","the","value","at","the","specified","key",".","Args",":","sample",":","input","sample","which","will","be","transformed"]
code: def __call__(
      self, sample: Union[Tuple[Any], Dict[str, Any]]
  ) -> Union[Tuple[Any], Dict[str, Any]]:
      """Updates sample by applying a transform to the value at the specified key.
  
      Args:
          sample: input sample which will be transformed
  
      """
      if sample is None:
          return sample
  
      # Asserts + deal with tuple immutability
      convert_to_tuple = False
      if isinstance(sample, dict):
          assert (
              self.key in sample
          ), "This transform only supports dicts with key '{}'".format(
              self.key
          )
      elif isinstance(sample, (tuple, list)):
          assert self.key < len(
              sample
          ), "This transform only supports tuples / lists with key less "
          "than {length}, key provided {key}".format(
              length=len(sample), key=self.key
          )
          # Convert to list for transformation
          if isinstance(sample, tuple):
              convert_to_tuple = True
          sample = list(sample)
  
      sample[self.key] = self.transform(sample[self.key])
      if convert_to_tuple:
          sample = tuple(sample)
  
      return sample
  
imports: import collections
  from typing import Any, Callable, Dict, List, Optional, Tuple, Union
  import torchvision.transforms
  from .None import build_transforms, ClassyTransform, register_transform
label_desc: Use image node_id 3 for calling the ApplyTransformToKey obj's underlying member method code with example usage: obj.__call__(sample) and returns: sample, sample