class_docstr: Saves data in event and summary protos for tensorboard.
class_docstr_tok: ["Saves","data","in","event","and","summary","protos","for","tensorboard","."]
docstr: Saves audio as wave.
  
  NB: single channel only right now.
  
  Args:
    tag: str: label for this data
    audiodata: ndarray [Nsamples, Nframes, Nchannels]: audio data to
      be saved as wave. The data will be clipped to [-1.0, 1.0].
    step: int: training step
    sample_rate: sample rate of passed in audio buffer
    max_outputs: At most this many audio clips will be emitted at each
      step. Defaults to 3.
docstr_tok: ["Saves","audio","as","wave",".","NB",":","single","channel","only","right","now",".","Args",":","tag",":","str",":","label","for","this","data","audiodata",":","ndarray","[","Nsamples",",","Nframes",",","Nchannels","]",":","audio","data","to","be","saved","as","wave",".","The","data","will","be","clipped","to","[","-1.0",",","1.0","]",".","step",":","int",":","training","step","sample_rate",":","sample","rate","of","passed","in","audio","buffer","max_outputs",":","At","most","this","many","audio","clips","will","be","emitted","at","each","step",".","Defaults","to","3","."]
code: def audio(
      self, tag, audiodata, step, sample_rate=44100, max_outputs=3
  ):
      """Saves audio as wave.
  
      NB: single channel only right now.
  
      Args:
        tag: str: label for this data
        audiodata: ndarray [Nsamples, Nframes, Nchannels]: audio data to
          be saved as wave. The data will be clipped to [-1.0, 1.0].
        step: int: training step
        sample_rate: sample rate of passed in audio buffer
        max_outputs: At most this many audio clips will be emitted at each
          step. Defaults to 3.
      """
      # tf.summary.audio expects the audio data to have floating values in
      # [-1.0, 1.0].
      audiodata = np.clip(np.array(audiodata), -1, 1)
  
      # Convert to tensor value as tf.summary.audio expects data to be a tensor.
      audio = tf.convert_to_tensor(audiodata, dtype=tf.float32)
      with self._as_default(self._event_writer):
          tf.summary.audio(
              name=tag,
              data=audio,
              sample_rate=sample_rate,
              step=step,
              max_outputs=max_outputs,
              encoding="wav",
          )
  
file_path: flax/flax/metrics/tensorboard.py
imports: import contextlib
  import functools
  import os
  import numpy
  import tensorflow
  from tensorboard.plugins.hparams import api
  from flax import io
label_desc: Use image node_id 6 for calling the SummaryWriter obj's underlying member method code with example usage: obj.audio(tag, audiodata, step, sample_rate, max_outputs) without return types