Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-cloud-platform/3.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
Google cloud platform 将参数传递到GCMLE预测图_Google Cloud Platform_Google Cloud Ml - Fatal编程技术网

Google cloud platform 将参数传递到GCMLE预测图

Google cloud platform 将参数传递到GCMLE预测图,google-cloud-platform,google-cloud-ml,Google Cloud Platform,Google Cloud Ml,在我的ML引擎预测图中,我有一部分图需要花费很长的时间来计算,并不总是必要的。有没有一种方法可以创建一个布尔标志来跳过图形的这一部分?我希望在创建批处理预测作业或在线预测时传递此标志。例如,它可能类似于: gcloud ml引擎predict--model$model--version$version--json实例$json_实例--boolean_标志$boolean_标志 在上面的例子中,我要么传递True/False作为$BOOLEAN\u标志,然后这将确定是否对预测图的一部分进行评估。

在我的ML引擎预测图中,我有一部分图需要花费很长的时间来计算,并不总是必要的。有没有一种方法可以创建一个布尔标志来跳过图形的这一部分?我希望在创建批处理预测作业或在线预测时传递此标志。例如,它可能类似于:

gcloud ml引擎predict--model$model--version$version--json实例$json_实例--boolean_标志$boolean_标志

在上面的例子中,我要么传递True/False作为
$BOOLEAN\u标志
,然后这将确定是否对预测图的一部分进行评估。我可以想象,这个标志也可以在批处理预测作业的主体中传递,就像模型/版本一样。这有可能吗


我知道我可以在预测请求中添加一个新的输入字段,该字段对于批处理中的每个元素都是True/False,并且在我不想获得预测时将其作为False传递,但我很好奇是否有一种方法可以只使用一个参数来实现这一点。

这在当前是不可能的。我们希望更多地了解您对该功能的需求。请致电cloudml与我们联系-feedback@google.com

添加两个不同的导出签名,每个签名头不同,怎么样?然后可以部署到两个不同的端点?选择要调用的url,具体取决于您想要全部还是部分

编写两个服务输入函数,每种情况一个。在第一种情况下,将标志设置为零,在第二种情况下,将标志设置为一。使用类一和类零的原因是为了确保您有一批0和1:

def case1_serving_input_fn():
    feature_placeholders = ...
    features = ...
    features['myflag'] = tf.zeros_like(features['other'])
    return tf.estimator.export.ServingInputReceiver(features, feature_placeholders)

def case2_serving_input_fn():
    feature_placeholders = ...
    features = ...
    features['myflag'] = tf.ones_like(features['other'])
    return tf.estimator.export.ServingInputReceiver(features, feature_placeholders)
在训练和评估功能中,有两个导出器:

def train_and_evaluate(output_dir, nsteps):
  ...
  exporter1 = tf.estimator.LatestExporter('case1', case1_serving_input_fn)
  exporter2 = tf.estimator.LatestExporter('case2', case2_serving_input_fn)
  eval_spec=tf.estimator.EvalSpec(
                       input_fn = make_input_fn(eval_df, 1),
                       exporters = [exporter1, exporter2] )
  tf.estimator.train_and_evaluate(estimator, train_spec, eval_spec)

这听起来很有希望!你能给我举一个有两个不同出口签名的例子吗?我知道在我的tf.estimator.FinalExporter中,我可以传递不同的服务函数,但不清楚在服务函数之外,我如何能有两个不同的导出签名,并具有不同的图?