来自tensorflow_hub.module.Module的tf.estimator.Estimator

时间:2019-05-07 19:24:33

标签: python tensorflow embedding

我想从通用编码器创建Tensorflow估算器对象。我打算将此估算器传递给Amazon SageMaker。

这里是我要创建的对象的链接: custom estimator

这是通用编码器:

LIKE

我可以简单地在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() 个参数中设置train_op = embed吗?

0 个答案:

没有答案