Last active
July 17, 2022 15:11
-
-
Save thepurpleowl/a1caccc7554a0f38786f36a933ec34ce to your computer and use it in GitHub Desktop.
Visualize embeddings in tensorboard: using Tensorboard projector
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import tensorboard as tb | |
from torch.utils.tensorboard import SummaryWriter | |
import tensorflow as tf | |
tf.io.gfile = tb.compat.tensorflow_stub.io.gfile | |
writer = SummaryWriter() | |
writer.add_embedding(<embeddings>, <labels>) # (doc_vector, Y_true[:TRAIN_SIZE_EVALS[-3]]) | |
writer.close() | |
%load_ext tensorboard | |
%tensorboard --logdir=runs | |
# Taken from this answer: https://stackoverflow.com/a/41177133 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment