code: def structured_prior_model(params):
      propertyIsPresent = (
          pyro.sample(
              "propertyIsPresent", dist.Bernoulli(params.theta)
          ).item()
          == 1
      )
      if propertyIsPresent:
          # approximately integrate over a beta by enumerating over bins
          beta_bins = [
              0.01,
              0.1,
              0.2,
              0.3,
              0.4,
              0.5,
              0.6,
              0.7,
              0.8,
              0.9,
              0.99,
          ]
          ix = pyro.sample(
              "bin",
              dist.Categorical(
                  probs=discretize_beta_pdf(
                      beta_bins, params.gamma, params.delta
                  )
              ),
          )
          return beta_bins[ix]
      else:
          return 0
  
file_path: pyro/examples/rsa/generics.py
imports: import argparse
  import collections
  import numbers
  import torch
  from search_inference import HashingMarginal, Search, memoize
  import pyro
  import pyro.distributions
  import pyro.poutine
label_desc: Use image node_id 3 for calling a global function with example usage: structured_prior_model(params) and returns: beta_bins, int