code: def test_sine_positional_encoding(num_feats=16, batch_size=2):
      # test invalid type of scale
      with pytest.raises(AssertionError):
          module = SinePositionalEncoding(
              num_feats, scale=(3.0,), normalize=True
          )
  
      module = SinePositionalEncoding(num_feats)
      h, w = 10, 6
      mask = (torch.rand(batch_size, h, w) > 0.5).to(torch.int)
      assert not module.normalize
      out = module(mask)
      assert out.shape == (batch_size, num_feats * 2, h, w)
  
      # set normalize
      module = SinePositionalEncoding(num_feats, normalize=True)
      assert module.normalize
      out = module(mask)
      assert out.shape == (batch_size, num_feats * 2, h, w)
  
imports: import pytest
  import torch
  from mmdet.models.layers import LearnedPositionalEncoding, SinePositionalEncoding
label_desc: Use image node_id 1 for calling a global function with example usage: test_sine_positional_encoding(num_feats, batch_size) without return types