class_docstr: A torch.fx graph transformation that is reversible.
  
  It must implement the [`~optimum.fx.optimization.ReversibleTransformation.transform`] and
  [`~optimum.fx.optimization.ReversibleTransformation.reverse`] methods, and be used as a callable.
class_docstr_tok: ["A","torch.fx","graph","transformation","that","is","reversible",".","It","must","implement","the","[","`","~optimum.fx.optimization.ReversibleTransformation.transform","`","]","and","[","`","~optimum.fx.optimization.ReversibleTransformation.reverse","`","]","methods",",","and","be","used","as","a","callable","."]
docstr: Args:
      graph_module (`torch.fx.GraphModule`):
          The module to transform.
      lint_and_recompile (`bool`, defaults to `True`):
          Whether the transformed module should be linted and recompiled.
          This can be set to `False` when chaining transformations together to perform this operation only once.
      reverse (`bool`, defaults to `False`):
          If `True`, the reverse transformation is performed.
  
  Returns:
      `torch.fx.GraphModule`:
          The transformed module.
docstr_tok: ["Args",":","graph_module","(","`","torch.fx.GraphModule","`",")",":","The","module","to","transform",".","lint_and_recompile","(","`","bool","`",",","defaults","to","`","True","`",")",":","Whether","the","transformed","module","should","be","linted","and","recompiled",".","This","can","be","set","to","`","False","`","when","chaining","transformations","together","to","perform","this","operation","only","once",".","reverse","(","`","bool","`",",","defaults","to","`","False","`",")",":","If","`","True","`",",","the","reverse","transformation","is","performed",".","Returns",":","`","torch.fx.GraphModule","`",":","The","transformed","module","."]
code: def __call__(
      self,
      graph_module: "GraphModule",
      lint_and_recompile: bool = True,
      reverse: bool = False,
  ) -> "GraphModule":
      """
      Args:
          graph_module (`torch.fx.GraphModule`):
              The module to transform.
          lint_and_recompile (`bool`, defaults to `True`):
              Whether the transformed module should be linted and recompiled.
              This can be set to `False` when chaining transformations together to perform this operation only once.
          reverse (`bool`, defaults to `False`):
              If `True`, the reverse transformation is performed.
  
      Returns:
          `torch.fx.GraphModule`:
              The transformed module.
  
      """
      func = self.transform if not reverse else self.reverse
      graph_module = func(graph_module)
      if lint_and_recompile:
          graph_module.graph.lint()
          graph_module.recompile()
      return graph_module
  
imports: import collections
  import copy
  import functools
  import itertools
  import operator
  import warnings
  from abc import ABC, abstractmethod
  from typing import TYPE_CHECKING, List
  import torch
  from transformers.file_utils import add_end_docstrings
  from transformers.utils.fx import _gen_constructor_wrapper
label_desc: Use image node_id 2 for calling the ReversibleTransformation obj's underlying member method code with example usage: obj.__call__(graph_module, lint_and_recompile, reverse) and returns: graph_module