class_docstr: Generates a pair of :class:`Checkpoint` and :class:`Recompute`.
docstr: Apply :class:`Recompute` to the batch in place.
docstr_tok: ["Apply",":","class",":","`","Recompute","`","to","the","batch","in","place","."]
code: def recompute(self, batch: Batch) -> None:
      """Apply :class:`Recompute` to the batch in place."""
      input_atomic = self.batch.atomic
      inputs = tuple(self.batch)
  
      # Use a tensor in the batch to tie together fork-join
      tensor_idx = batch.find_tensor_idx()
      # batch[tensor_idx] is always requiring grad, because it has been passed
      # checkpoint with a phony requiring grad.
      batch[tensor_idx], phony = fork(batch[tensor_idx])
      phony = Recompute.apply(
          phony,
          self.recomputed,
          self.rng_states,
          self.function,
          input_atomic,
          *inputs,
      )
      batch[tensor_idx] = join(batch[tensor_idx], phony)
  
imports: from collections import deque
  from contextlib import contextmanager
  import threading
  from typing import Any, Deque, Generator, List, Optional, Protocol, Union, Sequence, Tuple
  import torch
  from torch import Tensor
  import torch.autograd
  from .dependency import fork, join
  from .microbatch import Batch
  from .phony import get_phony
label_desc: Use image node_id 3 for calling the Checkpointing obj's underlying member method code with example usage: obj.recompute(batch) without return types