class_docstr: Model using ResNet50 to predict single 3D oriented bounding box.
docstr: Training step.
  
  Args:
    sample: Training sample.
    optimizer: The optimizer.
    global_batch_size: The global batch size.
  
  Returns:
    Dicts of model inputs and outputs.
docstr_tok: ["Training","step",".","Args",":","sample",":","Training","sample",".","optimizer",":","The","optimizer",".","global_batch_size",":","The","global","batch","size",".","Returns",":","Dicts","of","model","inputs","and","outputs","."]
code: def train_sample(self, sample, optimizer, global_batch_size):
      """Training step.
  
      Args:
        sample: Training sample.
        optimizer: The optimizer.
        global_batch_size: The global batch size.
  
      Returns:
        Dicts of model inputs and outputs.
      """
  
      inputs = {}
      self.decode_batch(sample, inputs)
  
      with tf.GradientTape() as t:
          predictions = self.network(inputs["image"])
          outputs = self.decode_predictions(predictions, inputs, {})
          outputs = self.compute_loss(
              inputs, outputs, global_batch_size
          )
          network_gradients = t.gradient(
              outputs["loss/total"], self.network.trainable_weights
          )
      optimizer.apply_gradients(
          zip(network_gradients, self.network.trainable_weights)
      )
      return inputs, outputs
  
imports: import math
  import tensorflow
label_desc: Use image node_id 3 for calling the SingleObjectModel obj's underlying member method code with example usage: obj.train_sample(sample, optimizer, global_batch_size) and returns: inputs,  outputs