class_docstr: This class transforms a float32 tensor into a lower resolution one
  (e.g., int16, int8, float16) and then converts it back to a float32.
  This process loses information and can be used for data augmentation.
  
  Arguments:
  ---------
      target_dtype: str
          One of "int16", "int8", "float16". If "random", the bit resolution
          is randomly selected among the options listed above.
  
  Example:
      >>> dropper = DropBitResolution()
      >>> signal = torch.rand(4, 16000)
      >>> signal_dropped = dropper(signal)
class_docstr_tok: ["This","class","transforms","a","float32","tensor","into","a","lower","resolution","one","(","e.g.",",","int16",",","int8",",","float16",")","and","then","converts","it","back","to","a","float32",".","This","process","loses","information","and","can","be","used","for","data","augmentation",".","Arguments",":","--","--","--","--","-","target_dtype",":","str","One","of","``","int16","''",",","``","int8","''",",","``","float16","''",".","If","``","random","''",",","the","bit","resolution","is","randomly","selected","among","the","options","listed","above",".","Example",":",">",">",">","dropper","=","DropBitResolution","(",")",">",">",">","signal","=","torch.rand","(","4",",","16000",")",">",">",">","signal_dropped","=","dropper","(","signal",")"]
docstr: Arguments:
  ---------
      float32_tensor: torch.Tensor
          Float32 tensor with shape `[batch, time]` or `[batch, time, channels]`.
  
  Returns:
  ---------
      torch.Tensor
          Tensor of shape `[batch, time]` or `[batch, time, channels]` (Float32)
docstr_tok: ["Arguments",":","--","--","--","--","-","float32_tensor",":","torch.Tensor","Float32","tensor","with","shape","`","[","batch",",","time","]","`","or","`","[","batch",",","time",",","channels","]","`",".","Returns",":","--","--","--","--","-","torch.Tensor","Tensor","of","shape","`","[","batch",",","time","]","`","or","`","[","batch",",","time",",","channels","]","`","(","Float32",")"]
code: def forward(self, float32_tensor):
      """
      Arguments:
      ---------
          float32_tensor: torch.Tensor
              Float32 tensor with shape `[batch, time]` or `[batch, time, channels]`.
  
      Returns:
      ---------
          torch.Tensor
              Tensor of shape `[batch, time]` or `[batch, time, channels]` (Float32)
      """
  
      if self.target_dtype == "random":
          random_key = random.choice(list(self.bit_depths.keys()))
          bit, target_dtype = self.bit_depths[random_key]
      else:
          bit, target_dtype = self.bit_depths[self.target_dtype]
  
      # Define a scale factor to map the float32 range to the target bit depth
      if target_dtype != torch.float16:
          scale_factor = (
              2 ** (bit - 1) - 1
          ) / float32_tensor.abs().max()
          quantized_tensor = (float32_tensor * scale_factor).to(
              target_dtype
          )
      else:
          quantized_tensor = float32_tensor.half()
          scale_factor = 1
  
      # To dequantize and recover the original float32 values
      dequantized_tensor = (
          quantized_tensor.to(torch.float32) / scale_factor
      )
      return dequantized_tensor
  
imports: import math
  import random
  import torch
  import torch.nn.functional
  from speechbrain.dataio.legacy import ExtendedCSVDataset
  from speechbrain.dataio.dataloader import make_dataloader
  from speechbrain.processing.signal_processing import compute_amplitude, dB_to_amplitude, convolve1d, notch_filter, reverberate
label_desc: Use image node_id 2 for calling the DropBitResolution obj's underlying member method code with example usage: obj.forward(float32_tensor) and returns: dequantized_tensor