class_docstr: Inverse synthesis model (ddsp-inv).
  
  EXPERIMENTAL
  
  Builds a hierarchical model of audio:
  Audio -> Sinusoid -> Harmonic -> Sinusoid -> Audio.
  
  Unlike other models, the processor group is defined in the constructor, as
  there are many synthesizer specific regularizers and self-supervised losses.
class_docstr_tok: ["Inverse","synthesis","model","(","ddsp-inv",")",".","EXPERIMENTAL","Builds","a","hierarchical","model","of","audio",":","Audio","-",">","Sinusoid","-",">","Harmonic","-",">","Sinusoid","-",">","Audio",".","Unlike","other","models",",","the","processor","group","is","defined","in","the","constructor",",","as","there","are","many","synthesizer","specific","regularizers","and","self-supervised","losses","."]
docstr: Run the core of the network, get predictions and loss.
docstr_tok: ["Run","the","core","of","the","network",",","get","predictions","and","loss","."]
code: def call(self, features, training=True):
      """Run the core of the network, get predictions and loss."""
      if isinstance(features, (list, tuple)):
          # Train on both normal and self-supervised data.
          features, ss_features = self.parse_zipped_features(features)
  
          # Generate audio from controls if self_supervised.
          ss_features = ddsp.core.copy_if_tf_function(ss_features)
          ss_features["audio"] = self.generate_synthetic_audio(
              ss_features
          )
  
          # Concatenate inputs for more efficiency.
          batch_size = features["audio"].shape[0]
          inputs = {
              "audio": tf.concat(
                  [features["audio"], ss_features["audio"]], axis=0
              )
          }
  
          # Pass through the model.
          all_outputs = self.forward(inputs, training)
  
          # Split outputs.
          outputs = {
              k: v[:batch_size]
              for k, v in all_outputs.items()
              if not isinstance(v, dict)
          }
          ss_outputs = {
              k: v[batch_size:]
              for k, v in all_outputs.items()
              if not isinstance(v, dict)
          }
  
          # Compute losses.
          self.append_losses(outputs)
          self.append_losses(ss_outputs, ss_features)
  
      elif features.get("sin_amps") is not None:
          # Self supervised pretraining.
          ss_features = ddsp.core.copy_if_tf_function(features)
          ss_features["audio"] = self.generate_synthetic_audio(
              ss_features
          )
          outputs = self.forward(ss_features, training)
          self.append_losses(outputs)
          self.append_losses(outputs, ss_features)
  
      else:
          # Normal training procedure.
          outputs = self.forward(features, training)
          self.append_losses(outputs)
  
      return outputs
  
file_path: ddsp/ddsp/training/models/inverse_synthesis.py
imports: import functools
  import ddsp
  from ddsp.training.models.model import Model
  import tensorflow
label_desc: Use image node_id 5 for calling the InverseSynthesis obj's underlying member method code with example usage: obj.call(features, training) and returns: outputs