code: def _pyro_sample_from_prior(module, memo=None, prefix=""):
      try:
          import pyro
      except ImportError:
          raise RuntimeError(
              "Cannot call pyro_sample_from_prior without pyro installed!"
          )
  
      if memo is None:
          memo = set()
      if hasattr(module, "_priors"):
          for prior_name, (
              prior,
              closure,
              setting_closure,
          ) in module._priors.items():
              if prior is not None and prior not in memo:
                  if setting_closure is None:
                      raise RuntimeError(
                          "Cannot use Pyro for sampling without a setting_closure for each prior,"
                          f" but the following prior had none: {prior_name}, {prior}."
                      )
                  memo.add(prior)
                  prior = prior.expand(closure(module).shape)
                  value = pyro.sample(
                      prefix + ("." if prefix else "") + prior_name,
                      prior,
                  )
                  setting_closure(module, value)
  
      for mname, module_ in module.named_children():
          submodule_prefix = prefix + ("." if prefix else "") + mname
          _pyro_sample_from_prior(
              module=module_, memo=memo, prefix=submodule_prefix
          )
  
      return module
  
imports: import copy
  import inspect
  import itertools
  import operator
  from collections import OrderedDict
  from typing import Union
  import torch
  from linear_operator.operators import LinearOperator
  from torch import nn, Tensor
  from torch.distributions import Distribution
  from .constraints import Interval
label_desc: Use image node_id 3 for calling a global function with example usage: _pyro_sample_from_prior(module, memo, prefix) and returns: module