class_docstr: Manage Onsets and Frames TFLite model.
docstr: Do inference over the provided samples.
code: def infer(self, samples):
      """Do inference over the provided samples."""
      self._interpreter.set_tensor(
          self._interpreter.get_input_details()[0]["index"], samples
      )
  
      self._interpreter.invoke()
      predictions = [
          self._interpreter.get_tensor(
              self._output_index["frame_logits"]
          ),
          self._interpreter.get_tensor(
              self._output_index["onset_logits"]
          ),
          self._interpreter.get_tensor(
              self._output_index["offset_logits"]
          ),
          self._interpreter.get_tensor(
              self._output_index["velocity_values"]
          ),
      ]
      # Use axis 0 to stack but then shove the axis to the end so its
      # [time, midinote (0-88), {frame,onset, offset, velocity}]
      # The first 3 are logits, the last is simply the velocity
      result = np.transpose(
          np.concatenate(predictions, axis=0), [1, 2, 0]
      )
  
      # TODO(fjord): Add onset filtering similar to our regular inference
      # setup.
      return result
  
file_path: magenta/magenta/models/onsets_frames_transcription/realtime/tflite_model.py
imports: import importlib
  import numpy
label_desc: Use image node_id 7 for calling the Model obj's underlying member method code with example usage: obj.infer(samples) and returns: result