code: def i16_pcm(wav: torch.Tensor) -> torch.Tensor:
      """Convert audio to int 16 bits PCM format.
  
      ..Warning:: There exist many formula for doing this conversion. None are perfect
      due to the asymmetry of the int16 range. One either have possible clipping, DC offset,
      or inconsistencies with f32_pcm. If the given wav doesn't have enough headroom,
      it is possible that `i16_pcm(f32_pcm)) != Identity`.
      """
      if wav.dtype.is_floating_point:
          assert wav.abs().max() <= 1
          candidate = (wav * 2**15).round()
          if candidate.max() >= 2**15:  # clipping would occur
              candidate = (wav * (2**15 - 1)).round()
          return candidate.short()
      else:
          assert wav.dtype == torch.int16
          return wav
  
file_path: audiocraft/audiocraft/data/audio_utils.py
imports: import sys
  import typing
  import julius
  import torch
  import torchaudio
label_desc: Use image node_id 7 for calling a global function with example usage: i16_pcm(wav) and returns: candidate, wav