docstr: Sends the gradient tensor to and copy the gradient tensor from the next stage in pipeline
  
  Args:
      input_object (Any): Object to be sent.
      next_rank (int, optional): The rank of the sender and recipient of the tensor
docstr_tok: ["Sends","the","gradient","tensor","to","and","copy","the","gradient","tensor","from","the","next","stage","in","pipeline","Args",":","input_object","(","Any",")",":","Object","to","be","sent",".","next_rank","(","int",",","optional",")",":","The","rank","of","the","sender","and","recipient","of","the","tensor"]
code: def send_forward_recv_backward(
      self,
      input_object: Any,
      next_rank: Optional[int] = None,
      send_metadata: bool = True,
      metadata_recv: Optional[P2PMetadata] = None,
      send_prior_fallback: Optional[bool] = None,
  ) -> Any:
      """Sends the gradient tensor to and copy the gradient tensor from the next stage in pipeline
  
      Args:
          input_object (Any): Object to be sent.
          next_rank (int, optional): The rank of the sender and recipient of the tensor
      """
      if next_rank is None:
          next_rank = self.stage_manager.get_next_rank()
  
      cur_rank = self.stage_manager.get_rank()
      group = self.stage_manager.get_p2p_process_group(
          cur_rank, next_rank
      )
      return _communicate(
          input_object,
          next_rank,
          next_rank,
          send_group=group,
          recv_group=group,
          send_metadata=send_metadata,
          metadata_recv=metadata_recv,
          send_prior_fallback=send_prior_fallback,
      )
  
imports: import io
  import pickle
  import re
  from collections import namedtuple
  from typing import Any, Callable, List, Optional, Tuple, Union
  import torch
  import torch.distributed
  from packaging.version import Version
  from torch.distributed import ProcessGroup
  from torch.distributed import distributed_c10d
  from torch.utils._pytree import tree_flatten, tree_unflatten
  from .stage_manager import PipelineStageManager
label_desc: Use image node_id 6 for calling the PipelineP2PCommunication obj's underlying member method code with example usage: obj.send_forward_recv_backward(input_object, next_rank, send_metadata, metadata_recv, send_prior_fallback) and returns: _communicate