Created
February 3, 2019 08:48
-
-
Save jainanchit51/9ee6810b3b7bfc47ad668c7f08cda88b to your computer and use it in GitHub Desktop.
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 tensorflow as tf | |
import tensorflow_hub as hub | |
# enabling the pretrained model for trainig our custom model using tensorflow hub | |
module_url = "https://tfhub.dev/google/universal-sentence-encoder-large/3" | |
embed = hub.Module(module_url) | |
# creating a method for embedding and will using method for every input layer | |
def UniversalEmbedding(x): | |
return embed(tf.squeeze(tf.cast(x, tf.string)), signature="default", as_dict=True)["default"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment