class_docstr: Parses the inputs and outputs of `Scan` in an easy to manipulate format.
class_docstr_tok: ["Parses","the","inputs","and","outputs","of","`","Scan","`","in","an","easy","to","manipulate","format","."]
code: def remove_from_fields(
      self, i: Variable, rm_dependents: bool = True
  ) -> list[tuple[Variable, Optional[FieldInfo]]]:
      if rm_dependents:
          vars_to_remove = self.get_dependent_nodes(i) | {i}
      else:
          vars_to_remove = {i}
  
      rm_info: list[tuple[Variable, Optional[FieldInfo]]] = []
      for v in vars_to_remove:
          dependent_rm_info = self._remove_from_fields(v)
          rm_info.append((v, dependent_rm_info))
  
      return rm_info
  
imports: import copy
  import dataclasses
  import logging
  from collections import OrderedDict, namedtuple
  from collections.abc import Sequence
  from itertools import chain
  from typing import TYPE_CHECKING, Callable, Optional, Union
  from typing import cast
  import numpy
  from pytensor import scalar
  from pytensor import tensor
  from pytensor.compile.profiling import ProfileStats
  from pytensor.configdefaults import config
  from pytensor.graph.basic import Constant, Variable, equal_computations, graph_inputs
  from pytensor.graph.op import get_test_value
  from pytensor.graph.replace import clone_replace
  from pytensor.graph.type import HasDataType
  from pytensor.graph.utils import TestValueError
  from pytensor.tensor.basic import AllocEmpty, cast
  from pytensor.tensor.subtensor import set_subtensor
  from pytensor.tensor.variable import TensorConstant
label_desc: Use image node_id 17 for calling the ScanArgs obj's underlying member method code with example usage: obj.remove_from_fields(i, rm_dependents) and returns: rm_info