Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/314.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/tensorflow/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python tf.estimator.estimator来自tensorflow_hub.module.module_Python_Tensorflow_Embedding - Fatal编程技术网

Python tf.estimator.estimator来自tensorflow_hub.module.module

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

我想从通用编码器创建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.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