code: def main(args):
      # Here Alice and Bob slightly prefer one location over the other a priori
      shared_preference = torch.tensor([args.preference])
  
      bob_depth = args.depth
      num_samples = args.num_samples
  
      # We sample Bob's choice of location by marginalizing
      # over his decision process.
      bob_decision = HashingMarginal(
          Search(bob).run(shared_preference, bob_depth)
      )
      bob_prob = bob_decision._dist_and_values()[0].probs
      print("bob prob", bob_prob)
  
      # draw num_samples samples from Bob's decision process
      # and use those to estimate the marginal probability
      # that Bob chooses their preferred location
      bob_prob = sum(
          [bob_decision() for i in range(num_samples)]
      ) / float(num_samples)
  
      print(
          "Empirical frequency of Bob choosing their favored location "
          + "given preference {} and recursion depth {}: {}".format(
              shared_preference, bob_depth, bob_prob
          )
      )
  
file_path: pyro/examples/rsa/schelling.py
imports: import argparse
  import torch
  from search_inference import HashingMarginal, Search
  import pyro
  import pyro.poutine
  from pyro.distributions import Bernoulli
label_desc: Use image node_id 4 for calling a global function with example usage: main(args) without return types