code: def test_forward(self):
      expected_cos = torch.tensor(
          [
              [[[1.0000, 1.0000]]],
              [[[0.5403, 0.5403]]],
              [[[-0.4161, -0.4161]]],
          ]
      )
      expected_sin = torch.tensor(
          [
              [[[0.0000, 0.0000]]],
              [[[0.8415, 0.8415]]],
              [[[0.9093, 0.9093]]],
          ]
      )
      cos, sin = self.rope_pos_emd(self.sample, self.T)
      self.assertTrue(
          np.allclose(
              expected_cos.cpu().detach().numpy(),
              cos.cpu().detach().numpy(),
              atol=1e-4,
          )
      )
      self.assertTrue(
          np.allclose(
              expected_sin.cpu().detach().numpy(),
              sin.cpu().detach().numpy(),
              atol=1e-4,
          )
      )
  
file_path: fairseq/tests/test_rotary_positional_embedding.py
imports: import torch
  import numpy
  import unittest
  from fairseq.modules.rotary_positional_embedding import apply_rotary_pos_emb
  from fairseq.modules import RotaryPositionalEmbedding
label_desc: Use image node_id 2 for calling the TestRotaryPositionalEmbedding obj's underlying member method code with example usage: obj.test_forward() without return types