Python tf.estimator.estimator来自tensorflow_hub.module.module
我想从通用编码器创建Tensorflow估计器对象。我计划将此估计器传递给亚马逊SageMaker 下面是我要创建的对象的链接: 这是通用编码器:Python tf.estimator.estimator来自tensorflow_hub.module.module,python,tensorflow,embedding,Python,Tensorflow,Embedding,我想从通用编码器创建Tensorflow估计器对象。我计划将此估计器传递给亚马逊SageMaker 下面是我要创建的对象的链接: 这是通用编码器: import tensorflow as tf import tensorflow_hub as hub g = tf.Graph() with g.as_default(): # We will be feeding 1D tensors of text into the graph. text_input = tf.placeholde
import tensorflow as tf
import tensorflow_hub as hub
g = tf.Graph()
with g.as_default():
# We will be feeding 1D tensors of text into the graph.
text_input = tf.placeholder(dtype=tf.string, shape=[None])
embed = hub.Module("https://tfhub.dev/google/universal-sentence-encoder/2")
print(type(embed))
embedded_text = embed(text_input)
init_op = tf.group([tf.global_variables_initializer(), tf.tables_initializer()])
g.finalize()
我可以简单地在tf.estimator.estimator spec
参数中设置train\u op=embed