code: def test_lsh_hash_nearby(scale):
      k = 5
      lsh = LSH(scale)
      a = -2 * scale + torch.rand(k) * scale * 0.49
      b = -1 * scale + torch.rand(k) * scale * 0.49
      c = torch.rand(k) * scale * 0.49
      d = scale + torch.rand(k) * scale * 0.49
      e = 2 * scale + torch.rand(k) * scale * 0.49
      f = 4 * scale + torch.rand(k) * scale * 0.49
  
      assert_equal(lsh._hash(a), (-2,) * k)
      assert_equal(lsh._hash(b), (-1,) * k)
      assert_equal(lsh._hash(c), (0,) * k)
      assert_equal(lsh._hash(d), (1,) * k)
      assert_equal(lsh._hash(e), (2,) * k)
      assert_equal(lsh._hash(f), (4,) * k)
  
      lsh.add("a", a)
      lsh.add("b", b)
      lsh.add("c", c)
      lsh.add("d", d)
      lsh.add("e", e)
      lsh.add("f", f)
  
      assert lsh.nearby("a") == {"b"}
      assert lsh.nearby("b") == {"a", "c"}
      assert lsh.nearby("c") == {"b", "d"}
      assert lsh.nearby("d") == {"c", "e"}
      assert lsh.nearby("e") == {"d"}
      assert lsh.nearby("f") == set()
  
file_path: pyro/tests/contrib/tracking/test_hashing.py
imports: import logging
  import pytest
  import torch
  from pyro.contrib.tracking.hashing import LSH, ApproxSet, merge_points
  from tests.common import assert_equal
label_desc: Use image node_id 3 for calling a global function with example usage: test_lsh_hash_nearby(scale) without return types