Nearest neighbours word embedding computation.
Project description
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.
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
pip install tensorflow_nearest_neighbours
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tensorflow_nearest_neighbours-0.0.1.dev1-cp310-cp310-manylinux2014_x86_64.whl.
File metadata
- Download URL: tensorflow_nearest_neighbours-0.0.1.dev1-cp310-cp310-manylinux2014_x86_64.whl
- Upload date:
- Size: 151.2 kB
- Tags: CPython 3.10
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c1302cc7d263839ba74f6335ea2e36a30afb7623d7c980fe2593829cb443715e
|
|
| MD5 |
75940523ac9b9244f507181d04a9a08c
|
|
| BLAKE2b-256 |
744daf578f40e00beeaa2c97484360bee73b4591c71f4308c136156f0b749958
|
File details
Details for the file tensorflow_nearest_neighbours-0.0.1.dev1-cp310-cp310-macosx_13_0_arm64.whl.
File metadata
- Download URL: tensorflow_nearest_neighbours-0.0.1.dev1-cp310-cp310-macosx_13_0_arm64.whl
- Upload date:
- Size: 140.1 kB
- Tags: CPython 3.10, macOS 13.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6a5fce6606ddec93b4ca684c87bd2e18890b23004262251649123fa1a71e29e3
|
|
| MD5 |
dbe350ffca1f7a5920a09439d3134ba2
|
|
| BLAKE2b-256 |
f60744addf292b6b13141f005e37eda465a5d745ec5d96501b04008e5d51956c
|
File details
Details for the file tensorflow_nearest_neighbours-0.0.1.dev1-cp39-cp39-manylinux2014_x86_64.whl.
File metadata
- Download URL: tensorflow_nearest_neighbours-0.0.1.dev1-cp39-cp39-manylinux2014_x86_64.whl
- Upload date:
- Size: 151.3 kB
- Tags: CPython 3.9
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4e3cb23154db6b383a09d5ec95c45b1ba444272226b60958b7bc20c36480350e
|
|
| MD5 |
22d34703e40766f4d4ce350f5a184034
|
|
| BLAKE2b-256 |
06e73abad04d392a4176b5dd5ffddcff6cdae337771a9858477b8e877932d4ba
|
File details
Details for the file tensorflow_nearest_neighbours-0.0.1.dev1-cp39-cp39-macosx_13_0_arm64.whl.
File metadata
- Download URL: tensorflow_nearest_neighbours-0.0.1.dev1-cp39-cp39-macosx_13_0_arm64.whl
- Upload date:
- Size: 140.1 kB
- Tags: CPython 3.9, macOS 13.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
53c5b05da94982ab72e973c269ac857b60b673d588b96e9b7c7c20e1f4777e6f
|
|
| MD5 |
1241ca2c16aea5e4d7ddd7afeff4c43f
|
|
| BLAKE2b-256 |
04f123e72a4b3425b7bce52450bfa36c44fc3897d27abef7f95ece6adef6caab
|
File details
Details for the file tensorflow_nearest_neighbours-0.0.1.dev1-cp38-cp38-manylinux2014_x86_64.whl.
File metadata
- Download URL: tensorflow_nearest_neighbours-0.0.1.dev1-cp38-cp38-manylinux2014_x86_64.whl
- Upload date:
- Size: 151.3 kB
- Tags: CPython 3.8
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
097d299f433150b80bdbfda3ff2f9c89656bf3fcdc4fab68bdf1c0e5a1e735d1
|
|
| MD5 |
af1781478f7e410928f78b67112c7da3
|
|
| BLAKE2b-256 |
f3f9dd7df15a7cf14378e6899bf1e81dce92cac63ed16843698721ca102808e3
|
File details
Details for the file tensorflow_nearest_neighbours-0.0.1.dev1-cp38-cp38-macosx_13_0_arm64.whl.
File metadata
- Download URL: tensorflow_nearest_neighbours-0.0.1.dev1-cp38-cp38-macosx_13_0_arm64.whl
- Upload date:
- Size: 140.1 kB
- Tags: CPython 3.8, macOS 13.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
87657b80fb45ed4d4627ae8fd9f085c8513eb39c9413976fbe3adfcd73a2749f
|
|
| MD5 |
e804cc9143111ccb5dcbd80f2d4bb2ab
|
|
| BLAKE2b-256 |
c61479dc2f231928aa8bf453dbf4dcf664fa469ce2d87284f65a4244efeb0758
|