code: def model_3(capture_history, sex):
      def logit(p):
          return torch.log(p) - torch.log1p(-p)
  
      N, T = capture_history.shape
      phi_mean = pyro.sample(
          "phi_mean", dist.Uniform(0.0, 1.0)
      )  # mean survival probability
      phi_logit_mean = logit(phi_mean)
      # controls temporal variability of survival probability
      phi_sigma = pyro.sample("phi_sigma", dist.Uniform(0.0, 10.0))
      rho = pyro.sample(
          "rho", dist.Uniform(0.0, 1.0)
      )  # recapture probability
  
      z = torch.ones(N)
      first_capture_mask = torch.zeros(N).bool()
      # we create the plate once, outside of the loop over t
      animals_plate = pyro.plate("animals", N, dim=-1)
      for t in pyro.markov(range(T)):
          phi_logit_t = (
              pyro.sample(
                  "phi_logit_{}".format(t),
                  dist.Normal(phi_logit_mean, phi_sigma),
              )
              if t > 0
              else torch.tensor(0.0)
          )
          phi_t = torch.sigmoid(phi_logit_t)
          with animals_plate, poutine.mask(mask=first_capture_mask):
              mu_z_t = first_capture_mask.float() * phi_t * z + (
                  1 - first_capture_mask.float()
              )
              # we use parallel enumeration to exactly sum out
              # the discrete states z_t.
              z = pyro.sample(
                  "z_{}".format(t),
                  dist.Bernoulli(mu_z_t),
                  infer={"enumerate": "parallel"},
              )
              mu_y_t = rho * z
              pyro.sample(
                  "y_{}".format(t),
                  dist.Bernoulli(mu_y_t),
                  obs=capture_history[:, t],
              )
          first_capture_mask |= capture_history[:, t].bool()
  
file_path: pyro/examples/capture_recapture/cjs.py
imports: import argparse
  import os
  import numpy
  import torch
  import pyro
  import pyro.distributions
  import pyro.poutine
  from pyro.infer import SVI, TraceEnum_ELBO, TraceTMC_ELBO
  from pyro.infer.autoguide import AutoDiagonalNormal
  from pyro.optim import Adam
label_desc: Use image node_id 3 for calling a global function with example usage: model_3(capture_history, sex) and returns: unknown