def METHOD_NAME(self):
    self._init_model_parallel()
    tensor = self.create_tensor(self.rank)
    next_tensor = None
    if parallel_state.is_pipeline_first_stage():
        next_tensor = p2p_communication.recv_backward(tensor_shape=self.shape, dtype=self.dtype)
    elif parallel_state.is_pipeline_last_stage():
        p2p_communication.send_backward(input_tensor_grad=tensor, tensor_shape=self.shape, dtype=self.dtype)
    else:
        next_tensor = p2p_communication.send_backward_recv_backward(
            input_tensor_grad=tensor,
            recv_next=True,
            tensor_shape=self.shape,
            dtype=self.dtype,
        )
    if parallel_state.is_pipeline_last_stage():
        self.assertIsNone(next_tensor)
    else:
        expected_next_tensor = self.create_tensor(self.rank + 1)
        self.assertEqual(next_tensor, expected_next_tensor)