code: def optimize_theta(
      feed_dict,
      loss,
      reset_op,
      train_op,
      rec_loss,
      glue_loss,
      sess,
      k,
      hparams,
  ):
      """Optimize the pose, theta, during tracking."""
      sess.run(reset_op)
      loss_val = 0
      glue_val = 0
      with trange(hparams.max_steps_per_frame) as t:
          for unused_i in t:
              loss_val, unused_var, rec_val, glue_val = sess.run(
                  [loss, train_op, rec_loss, glue_loss], feed_dict
              )
              t.set_description(
                  "Frame_{0} {1:.4f}|{2:.4f}".format(
                      k, rec_val, glue_val
                  )
              )
      return loss_val, glue_val
  
imports: from os import path
  import numpy
  from skimage import measure
  import tensorflow.compat.v1
  from tensorflow_graphics.projects.cvxnet.lib.libmise import mise
  from tensorflow_graphics.projects.nasa.lib import datasets
  from tensorflow_graphics.projects.nasa.lib import models
  import tensorflow_probability
  from tqdm import trange
  import trimesh
label_desc: Use image node_id 12 for calling a global function with example usage: optimize_theta(feed_dict, loss, reset_op, train_op, rec_loss, glue_loss, sess, k, hparams) and returns: loss_val,  glue_val