code: def guide_step(self, t, n, prev, inputs):
      rnn_input = torch.cat(
          (inputs["embed"], prev.z_where, prev.z_what, prev.z_pres), 1
      )
      h, c = self.rnn(rnn_input, (prev.h, prev.c))
      z_pres_p, z_where_loc, z_where_scale = self.predict(h)
  
      # Compute baseline estimates for discrete choice z_pres.
      infer_dict, bl_h, bl_c = self.baseline_step(prev, inputs)
  
      # Sample presence.
      z_pres = pyro.sample(
          "z_pres_{}".format(t),
          dist.Bernoulli(z_pres_p * prev.z_pres).to_event(1),
          infer=infer_dict,
      )
  
      sample_mask = z_pres if self.use_masking else torch.tensor(1.0)
  
      z_where = pyro.sample(
          "z_where_{}".format(t),
          dist.Normal(
              z_where_loc + self.z_where_loc_prior,
              z_where_scale * self.z_where_scale_prior,
          )
          .mask(sample_mask)
          .to_event(1),
      )
  
      # Figure 2 of [1] shows x_att depending on z_where and h,
      # rather than z_where and x as here, but I think this is
      # correct.
      x_att = image_to_window(
          z_where, self.window_size, self.x_size, inputs["raw"]
      )
  
      # Encode attention windows.
      z_what_loc, z_what_scale = self.encode(x_att)
  
      z_what = pyro.sample(
          "z_what_{}".format(t),
          dist.Normal(z_what_loc, z_what_scale)
          .mask(sample_mask)
          .to_event(1),
      )
      return GuideState(
          h=h,
          c=c,
          bl_h=bl_h,
          bl_c=bl_c,
          z_pres=z_pres,
          z_where=z_where,
          z_what=z_what,
      )
  
imports: from collections import namedtuple
  import torch
  import torch.nn
  import torch.nn.functional
  from modules import MLP, Decoder, Encoder, Identity, Predict
  import pyro
  import pyro.distributions
label_desc: Use image node_id 6 for calling the AIR obj's underlying member method code with example usage: obj.guide_step(t, n, prev, inputs) and returns: GuideState