# TensorFlow Nearest Neighbours Op
Given an embedding matrix `EM`, and batch of word embeddings `x`
find nearest embedding for each token `x_ij` in `EM`.
```python
import tensorflow as tf
from tensorflow_nearest_neighbours import nearest_neighbours
tf.debugging.set_log_device_placement(True)
x = tf.random.uniform(shape=[8, 10, 32])
EM = tf.random.uniform(shape=[500, 32])
result = nearest_neighbours(x, EM)
print(result.shape)
```
#### Instalation
```shell
pip install tensorflow_nearest_neighbours
```
Raw data
{
"_id": null,
"home_page": "",
"name": "tensorflow-nearest-neighbours",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "",
"keywords": "tensorflow,custom op",
"author": "Artem Sereda",
"author_email": "artem.sereda@campus.tu-berlin.de",
"download_url": "",
"platform": null,
"description": "# TensorFlow Nearest Neighbours Op\nGiven an embedding matrix `EM`, and batch of word embeddings `x` \nfind nearest embedding for each token `x_ij` in `EM`.\n\n```python\nimport tensorflow as tf\nfrom tensorflow_nearest_neighbours import nearest_neighbours\ntf.debugging.set_log_device_placement(True)\n\nx = tf.random.uniform(shape=[8, 10, 32])\nEM = tf.random.uniform(shape=[500, 32])\nresult = nearest_neighbours(x, EM)\nprint(result.shape)\n```\n\n#### Instalation\n```shell\npip install tensorflow_nearest_neighbours\n```\n",
"bugtrack_url": null,
"license": "",
"summary": "Nearest neighbours word embedding computation.",
"version": "0.0.1.dev1",
"project_urls": null,
"split_keywords": [
"tensorflow",
"custom op"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "f60744addf292b6b13141f005e37eda465a5d745ec5d96501b04008e5d51956c",
"md5": "dbe350ffca1f7a5920a09439d3134ba2",
"sha256": "6a5fce6606ddec93b4ca684c87bd2e18890b23004262251649123fa1a71e29e3"
},
"downloads": -1,
"filename": "tensorflow_nearest_neighbours-0.0.1.dev1-cp310-cp310-macosx_13_0_arm64.whl",
"has_sig": false,
"md5_digest": "dbe350ffca1f7a5920a09439d3134ba2",
"packagetype": "bdist_wheel",
"python_version": "cp310",
"requires_python": ">=3.8",
"size": 140100,
"upload_time": "2023-06-21T21:27:12",
"upload_time_iso_8601": "2023-06-21T21:27:12.954589Z",
"url": "https://files.pythonhosted.org/packages/f6/07/44addf292b6b13141f005e37eda465a5d745ec5d96501b04008e5d51956c/tensorflow_nearest_neighbours-0.0.1.dev1-cp310-cp310-macosx_13_0_arm64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "744daf578f40e00beeaa2c97484360bee73b4591c71f4308c136156f0b749958",
"md5": "75940523ac9b9244f507181d04a9a08c",
"sha256": "c1302cc7d263839ba74f6335ea2e36a30afb7623d7c980fe2593829cb443715e"
},
"downloads": -1,
"filename": "tensorflow_nearest_neighbours-0.0.1.dev1-cp310-cp310-manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "75940523ac9b9244f507181d04a9a08c",
"packagetype": "bdist_wheel",
"python_version": "cp310",
"requires_python": ">=3.8",
"size": 151246,
"upload_time": "2023-06-21T21:35:08",
"upload_time_iso_8601": "2023-06-21T21:35:08.926119Z",
"url": "https://files.pythonhosted.org/packages/74/4d/af578f40e00beeaa2c97484360bee73b4591c71f4308c136156f0b749958/tensorflow_nearest_neighbours-0.0.1.dev1-cp310-cp310-manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c61479dc2f231928aa8bf453dbf4dcf664fa469ce2d87284f65a4244efeb0758",
"md5": "e804cc9143111ccb5dcbd80f2d4bb2ab",
"sha256": "87657b80fb45ed4d4627ae8fd9f085c8513eb39c9413976fbe3adfcd73a2749f"
},
"downloads": -1,
"filename": "tensorflow_nearest_neighbours-0.0.1.dev1-cp38-cp38-macosx_13_0_arm64.whl",
"has_sig": false,
"md5_digest": "e804cc9143111ccb5dcbd80f2d4bb2ab",
"packagetype": "bdist_wheel",
"python_version": "cp38",
"requires_python": ">=3.8",
"size": 140099,
"upload_time": "2023-06-21T21:27:15",
"upload_time_iso_8601": "2023-06-21T21:27:15.066349Z",
"url": "https://files.pythonhosted.org/packages/c6/14/79dc2f231928aa8bf453dbf4dcf664fa469ce2d87284f65a4244efeb0758/tensorflow_nearest_neighbours-0.0.1.dev1-cp38-cp38-macosx_13_0_arm64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "f3f9dd7df15a7cf14378e6899bf1e81dce92cac63ed16843698721ca102808e3",
"md5": "af1781478f7e410928f78b67112c7da3",
"sha256": "097d299f433150b80bdbfda3ff2f9c89656bf3fcdc4fab68bdf1c0e5a1e735d1"
},
"downloads": -1,
"filename": "tensorflow_nearest_neighbours-0.0.1.dev1-cp38-cp38-manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "af1781478f7e410928f78b67112c7da3",
"packagetype": "bdist_wheel",
"python_version": "cp38",
"requires_python": ">=3.8",
"size": 151261,
"upload_time": "2023-06-21T21:35:10",
"upload_time_iso_8601": "2023-06-21T21:35:10.387256Z",
"url": "https://files.pythonhosted.org/packages/f3/f9/dd7df15a7cf14378e6899bf1e81dce92cac63ed16843698721ca102808e3/tensorflow_nearest_neighbours-0.0.1.dev1-cp38-cp38-manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "04f123e72a4b3425b7bce52450bfa36c44fc3897d27abef7f95ece6adef6caab",
"md5": "1241ca2c16aea5e4d7ddd7afeff4c43f",
"sha256": "53c5b05da94982ab72e973c269ac857b60b673d588b96e9b7c7c20e1f4777e6f"
},
"downloads": -1,
"filename": "tensorflow_nearest_neighbours-0.0.1.dev1-cp39-cp39-macosx_13_0_arm64.whl",
"has_sig": false,
"md5_digest": "1241ca2c16aea5e4d7ddd7afeff4c43f",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.8",
"size": 140100,
"upload_time": "2023-06-21T21:27:16",
"upload_time_iso_8601": "2023-06-21T21:27:16.683464Z",
"url": "https://files.pythonhosted.org/packages/04/f1/23e72a4b3425b7bce52450bfa36c44fc3897d27abef7f95ece6adef6caab/tensorflow_nearest_neighbours-0.0.1.dev1-cp39-cp39-macosx_13_0_arm64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "06e73abad04d392a4176b5dd5ffddcff6cdae337771a9858477b8e877932d4ba",
"md5": "22d34703e40766f4d4ce350f5a184034",
"sha256": "4e3cb23154db6b383a09d5ec95c45b1ba444272226b60958b7bc20c36480350e"
},
"downloads": -1,
"filename": "tensorflow_nearest_neighbours-0.0.1.dev1-cp39-cp39-manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "22d34703e40766f4d4ce350f5a184034",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.8",
"size": 151261,
"upload_time": "2023-06-21T21:35:11",
"upload_time_iso_8601": "2023-06-21T21:35:11.816895Z",
"url": "https://files.pythonhosted.org/packages/06/e7/3abad04d392a4176b5dd5ffddcff6cdae337771a9858477b8e877932d4ba/tensorflow_nearest_neighbours-0.0.1.dev1-cp39-cp39-manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-06-21 21:27:12",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "tensorflow-nearest-neighbours"
}