code: def test_pooling2d(device):
      from speechbrain.nnet.pooling import Pooling2d
  
      input = (
          torch.tensor([[1, 3, 2], [4, 6, 5]], device=device)
          .float()
          .unsqueeze(0)
      )
      pool = Pooling2d("max", (2, 3)).to(device)
      output = pool(input)
      assert output == 6
  
      input = (
          torch.tensor([[1, 3, 2], [4, 6, 5]], device=device)
          .float()
          .unsqueeze(0)
      )
      pool = Pooling2d("max", (1, 3)).to(device)
      output = pool(input)
      assert output[0][0] == 3
      assert output[0][1] == 6
  
      input = (
          torch.tensor([[1, 3, 2], [4, 6, 5]], device=device)
          .float()
          .unsqueeze(0)
      )
      pool = Pooling2d("avg", (2, 3)).to(device)
      output = pool(input)
      assert output == 3.5
  
      input = (
          torch.tensor([[1, 3, 2], [4, 6, 5]], device=device)
          .float()
          .unsqueeze(0)
      )
      pool = Pooling2d("avg", (1, 3)).to(device)
      output = pool(input)
      assert output[0][0] == 2
      assert output[0][1] == 5
  
      assert torch.jit.trace(pool, input)
  
imports: import torch
  import torch.nn
label_desc: Use image node_id 2 for calling a global function with example usage: test_pooling2d(device) without return types