code: def test__power_law_distribution() -> None:
      power_dist = pmsn_loss._power_law_distribution(
          size=4, exponent=0.5, device=torch.device("cpu")
      )
      # 2.784457050376173 == sum(1/(k**0.5) for k in range(1, 5))
      assert torch.allclose(
          power_dist,
          torch.Tensor(
              [
                  1 / (1**0.5),
                  1 / (2**0.5),
                  1 / (3**0.5),
                  1 / (4**0.5),
              ]
          )
          / 2.784457050376173,
      )
      assert power_dist.device == torch.device("cpu")
      assert torch.allclose(power_dist.sum(), torch.Tensor([1.0]))
  
file_path: lightly/tests/loss/test_PMSNLoss.py
imports: import math
  import unittest
  import pytest
  import torch
  from torch import Tensor
  from lightly.loss import pmsn_loss
  from lightly.loss.pmsn_loss import PMSNCustomLoss, PMSNLoss
label_desc: Use image node_id 1 for calling a global function with example usage: test__power_law_distribution() without return types