code: def rpc_optimizer():
      init_rpc()
      if torch.distributed.get_rank() != 0:
          rpc.shutdown()
          torch.distributed.barrier()
          return
  
      def model_with_reuse():
          reused_1 = nn.Linear(10, 10)
          return [
              reused_1,
              nn.ReLU(),
              reused_1,
              nn.ReLU(),
              reused_1,
              nn.ReLU(),
          ]
  
      check_pipe_against_reference(
          [2, 2, 2],
          lambda: [
              nn.Linear(10, 10),
              nn.ReLU(),
              nn.Linear(10, 10),
              nn.ReLU(),
              nn.Linear(10, 10),
              nn.ReLU(),
          ],
      )
      check_pipe_against_reference([2, 1, 1], model_with_reuse)
  
      rpc.shutdown()
      torch.distributed.barrier()
  
file_path: fairscale/tests/nn/pipe_process/test_rpc.py
imports: import copy
  import os
  import pytest
  import torch
  from torch import nn
  from torch.distributed import rpc
  from fairscale.fair_dev.testing.testing import get_worker_map, torch_spawn
  from fairscale.internal import torch_version
  from fairscale.nn.model_parallel.initialize import get_pipeline_parallel_group
  from fairscale.nn.pipe import PipeRPCWrapper
label_desc: Use image node_id 6 for calling a global function with example usage: rpc_optimizer() and returns: list