class_docstr: Test functions defined in `functional` module
class_docstr_tok: ["Test","functions","defined","in","`","functional","`","module"]
docstr: Check that clamps are applied per-item, not per channel.
docstr_tok: ["Check","that","clamps","are","applied","per-item",",","not","per","channel","."]
code: def test_amplitude_to_DB_not_channelwise_clamps(self):
      """Check that clamps are applied per-item, not per channel."""
      amplitude_mult = 20.0
      amin = 1e-10
      ref = 1.0
      db_mult = math.log10(max(amin, ref))
      top_db = 40.0
  
      spec = torch.rand([1, 2, 100, 100]) * 200
      # Make one channel blow out the other
      spec[:, 0] += 50
  
      specwise_dbs = F.amplitude_to_DB(
          spec, amplitude_mult, amin, db_mult, top_db=top_db
      )
      channelwise_dbs = torch.stack(
          [
              F.amplitude_to_DB(
                  spec[:, i],
                  amplitude_mult,
                  amin,
                  db_mult,
                  top_db=top_db,
              )
              for i in range(spec.size(-3))
          ]
      )
  
      # Just check channelwise gives a different answer.
      difference = (specwise_dbs - channelwise_dbs).abs()
      assert (difference >= 1e-5).any()
  
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 6 for calling the TestFunctional obj's underlying member method code with example usage: obj.test_amplitude_to_DB_not_channelwise_clamps() without return types