class_docstr: Test functions defined in `functional` module
class_docstr_tok: ["Test","functions","defined","in","`","functional","`","module"]
docstr: Ensure that the clamps are separate for each spectrogram in a batch.
  
  The clamp was determined per-batch in a prior implementation, which
  meant it was determined by the loudest item, thus items weren't
  independent. See:
  
  https://github.com/pytorch/audio/issues/994
docstr_tok: ["Ensure","that","the","clamps","are","separate","for","each","spectrogram","in","a","batch",".","The","clamp","was","determined","per-batch","in","a","prior","implementation",",","which","meant","it","was","determined","by","the","loudest","item",",","thus","items","weren't","independent",".","See",":","https",":","\/\/github.com\/pytorch\/audio\/issues\/994"]
code: def test_amplitude_to_DB_itemwise_clamps(self):
      """Ensure that the clamps are separate for each spectrogram in a batch.
  
      The clamp was determined per-batch in a prior implementation, which
      meant it was determined by the loudest item, thus items weren't
      independent. See:
  
      https://github.com/pytorch/audio/issues/994
  
      """
      amplitude_mult = 20.0
      amin = 1e-10
      ref = 1.0
      db_mult = math.log10(max(amin, ref))
      top_db = 20.0
  
      # Make a batch of noise
      spec = torch.rand([2, 2, 100, 100]) * 200
      # Make one item blow out the other
      spec[0] += 50
      kwargs = {
          "multiplier": amplitude_mult,
          "amin": amin,
          "db_multiplier": db_mult,
          "top_db": top_db,
      }
      func = partial(F.amplitude_to_DB, **kwargs)
      self.assert_batch_consistency(func, inputs=(spec,))
  
imports: import itertools
  import math
  from functools import partial
  import torch
  import torchaudio.functional
  from parameterized import parameterized, parameterized_class
  from torchaudio_unittest import common_utils
label_desc: Use image node_id 5 for calling the TestFunctional obj's underlying member method code with example usage: obj.test_amplitude_to_DB_itemwise_clamps() without return types