docstr: Copy the forward output from the previous stage in pipeline as the input tensor of this stage.
     For 1F1B.
  
  Args:
      prev_rank (int, optional): The rank of the source of the tensor.
  
  Returns:
      Any: The input tensor or input tensor list.
docstr_tok: ["Copy","the","forward","output","from","the","previous","stage","in","pipeline","as","the","input","tensor","of","this","stage",".","For","1F1B",".","Args",":","prev_rank","(","int",",","optional",")",":","The","rank","of","the","source","of","the","tensor",".","Returns",":","Any",":","The","input","tensor","or","input","tensor","list","."]
code: def recv_forward(self, prev_rank: int = None) -> Any:
      """Copy the forward output from the previous stage in pipeline as the input tensor of this stage.
         For 1F1B.
  
      Args:
          prev_rank (int, optional): The rank of the source of the tensor.
  
      Returns:
          Any: The input tensor or input tensor list.
      """
      if not self.stage_manager.is_first_stage():
          input_tensor = self.comm.recv_forward(
              prev_rank, metadata_recv=self.tensor_metadata_recv
          )
          if (
              self.enable_metadata_cache
              and self.tensor_metadata_recv is None
          ):
              self.tensor_metadata_recv = create_send_metadata(
                  input_tensor
              )
  
          return input_tensor
  
imports: from functools import partial
  from typing import Any, Callable, Dict, Iterable, List, Optional, Union
  import torch
  import torch.cuda
  from torch.nn import Module
  from torch.utils._pytree import tree_map
  from colossalai.interface import ModelWrapper, OptimizerWrapper
  from colossalai.pipeline.p2p import PipelineP2PCommunication, create_send_metadata
  from colossalai.pipeline.stage_manager import PipelineStageManager
  from colossalai.utils.device import get_current_device
  from ._utils import detach, get_batch_size, get_micro_batch, merge_batch, model_forward, retain_grad, to_device, tree_map_hf
  from .base import PipelineSchedule
label_desc: Use image node_id 4 for calling the OneForwardOneBackwardSchedule obj's underlying member method code with example usage: obj.recv_forward(prev_rank) and returns: input_tensor