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
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distributions
Close
Hashes for tensorflow_nearest_neighbours-0.0.1.dev1-cp310-cp310-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c1302cc7d263839ba74f6335ea2e36a30afb7623d7c980fe2593829cb443715e |
|
MD5 | 75940523ac9b9244f507181d04a9a08c |
|
BLAKE2b-256 | 744daf578f40e00beeaa2c97484360bee73b4591c71f4308c136156f0b749958 |
Close
Hashes for tensorflow_nearest_neighbours-0.0.1.dev1-cp310-cp310-macosx_13_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6a5fce6606ddec93b4ca684c87bd2e18890b23004262251649123fa1a71e29e3 |
|
MD5 | dbe350ffca1f7a5920a09439d3134ba2 |
|
BLAKE2b-256 | f60744addf292b6b13141f005e37eda465a5d745ec5d96501b04008e5d51956c |
Close
Hashes for tensorflow_nearest_neighbours-0.0.1.dev1-cp39-cp39-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4e3cb23154db6b383a09d5ec95c45b1ba444272226b60958b7bc20c36480350e |
|
MD5 | 22d34703e40766f4d4ce350f5a184034 |
|
BLAKE2b-256 | 06e73abad04d392a4176b5dd5ffddcff6cdae337771a9858477b8e877932d4ba |
Close
Hashes for tensorflow_nearest_neighbours-0.0.1.dev1-cp39-cp39-macosx_13_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 53c5b05da94982ab72e973c269ac857b60b673d588b96e9b7c7c20e1f4777e6f |
|
MD5 | 1241ca2c16aea5e4d7ddd7afeff4c43f |
|
BLAKE2b-256 | 04f123e72a4b3425b7bce52450bfa36c44fc3897d27abef7f95ece6adef6caab |
Close
Hashes for tensorflow_nearest_neighbours-0.0.1.dev1-cp38-cp38-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 097d299f433150b80bdbfda3ff2f9c89656bf3fcdc4fab68bdf1c0e5a1e735d1 |
|
MD5 | af1781478f7e410928f78b67112c7da3 |
|
BLAKE2b-256 | f3f9dd7df15a7cf14378e6899bf1e81dce92cac63ed16843698721ca102808e3 |
Close
Hashes for tensorflow_nearest_neighbours-0.0.1.dev1-cp38-cp38-macosx_13_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 87657b80fb45ed4d4627ae8fd9f085c8513eb39c9413976fbe3adfcd73a2749f |
|
MD5 | e804cc9143111ccb5dcbd80f2d4bb2ab |
|
BLAKE2b-256 | c61479dc2f231928aa8bf453dbf4dcf664fa469ce2d87284f65a4244efeb0758 |