class_docstr: Class to bind an optimizer, model, strategy, and training step function.
class_docstr_tok: ["Class","to","bind","an","optimizer",",","model",",","strategy",",","and","training","step","function","."]
docstr: Distributed training step.
docstr_tok: ["Distributed","training","step","."]
code: def train_step(self, inputs):
      """Distributed training step."""
      # Wrap iterator in tf.function, slight speedup passing in iter vs batch.
      batch = next(inputs) if hasattr(inputs, "__next__") else inputs
      losses = self.run(self.step_fn, batch)
      # Add up the scalar losses across replicas.
      n_replicas = self.strategy.num_replicas_in_sync
      return {
          k: self.psum(v, axis=None) / n_replicas
          for k, v in losses.items()
      }
  
file_path: ddsp/ddsp/training/trainers.py
imports: import time
  from absl import logging
  from ddsp.training import train_util
  import gin
  import tensorflow.compat.v2
label_desc: Use image node_id 10 for calling the Trainer obj's underlying member method code with example usage: obj.train_step(inputs) and returns: unknown