code: def test_vectors_deduplicate():
      data = OPS.asarray(
          [[1, 1], [2, 2], [3, 4], [1, 1], [3, 4]], dtype="f"
      )
      v = Vectors(data=data, keys=["a1", "b1", "c1", "a2", "c2"])
      vocab = Vocab()
      vocab.vectors = v
      # duplicate vectors do not use the same keys
      assert (
          vocab.vectors.key2row[v.strings["a1"]]
          != vocab.vectors.key2row[v.strings["a2"]]
      )
      assert (
          vocab.vectors.key2row[v.strings["c1"]]
          != vocab.vectors.key2row[v.strings["c2"]]
      )
      vocab.deduplicate_vectors()
      # there are three unique vectors
      assert vocab.vectors.shape[0] == 3
      # the uniqued data is the same as the deduplicated data
      assert_equal(
          numpy.unique(OPS.to_numpy(vocab.vectors.data), axis=0),
          OPS.to_numpy(vocab.vectors.data),
      )
      # duplicate vectors use the same keys now
      assert (
          vocab.vectors.key2row[v.strings["a1"]]
          == vocab.vectors.key2row[v.strings["a2"]]
      )
      assert (
          vocab.vectors.key2row[v.strings["c1"]]
          == vocab.vectors.key2row[v.strings["c2"]]
      )
      # deduplicating again makes no changes
      vocab_b = vocab.to_bytes()
      vocab.deduplicate_vectors()
      assert vocab_b == vocab.to_bytes()
  
imports: import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_almost_equal, assert_equal
  from thinc.api import NumpyOps, get_current_ops
  from spacy.lang.en import English
  from spacy.strings import hash_string
  from spacy.tokenizer import Tokenizer
  from spacy.tokens import Doc
  from spacy.training.initialize import convert_vectors
  from spacy.vectors import Vectors
  from spacy.vocab import Vocab
  from ..util import add_vecs_to_vocab, get_cosine, make_tempdir
label_desc: Use image node_id 45 for calling a global function with example usage: test_vectors_deduplicate() without return types