code: def functionalized_rng_runtime_epilogue(
      metadata: ViewAndMutationMeta, outs, return_new_outs=True
  ):
      if metadata.is_rng_op_functionalized:
          assert metadata.num_outputs_rng_offset == 1
          new_rng_offset = outs[-1]
          CUDARngStateHelper.set_new_offset(new_rng_offset)
          if return_new_outs:
              user_outs = outs[:-1]
              return user_outs
          else:
              return None
      return outs
  
imports: import collections
  import pprint
  from functools import wraps
  from typing import Any, Callable, Dict, List, Optional, Tuple, Union
  import torch
  import torch.utils.dlpack
  from torch import Tensor
  from torch._guards import DuplicateInputs, TracingContext
  from torch._prims_common import CUDARngStateHelper
  from torch.multiprocessing.reductions import StorageWeakRef
  from ..None import config
  from .collect_metadata_analysis import run_functionalized_fw_and_collect_metadata
  from .functional_utils import gen_alias_from_base
  from .input_output_analysis import compute_overlapping_inputs, create_synthetic_base_metadata, remove_dupe_metadata
  from .logging_utils import describe_input, format_guard_bug_msg
  from .schemas import AOTConfig, InputAliasInfo, OutputType, SubclassCreationMeta, TensorAlias, ViewAndMutationMeta
  from .subclass_utils import requires_subclass_dispatch, unwrap_tensor_subclasses, wrap_tensor_subclasses
  from .utils import call_func_at_runtime_with_args, make_boxed_func, partial_flatten_asdict, strict_zip
label_desc: Use image node_id 2 for calling a global function with example usage: functionalized_rng_runtime_epilogue(metadata, outs, return_new_outs) and returns: outs, user_outs, None