def _make_cloud_mlengine_request(examples):
    """Builds and sends requests to Cloud ML Engine."""
    api = discovery.build("ml", "v1", credentials=credentials)
    parent = "projects/%s/models/%s/versions/%s" % (cloud.default_project(),
                                                    model_name, version)
    input_data = {
        "instances": [{  # pylint: disable=g-complex-comprehension
            "input": {
                "b64": base64.b64encode(ex.SerializeToString())
            }
        } for ex in examples]
    }
    response = api.projects().predict(body=input_data, name=parent).execute()
    predictions = response["predictions"]
    for prediction in predictions:
      prediction["outputs"] = np.array([prediction["outputs"]])
      prediction["scores"] = np.array(prediction["scores"])
    return predictions
Builds and sends requests to Cloud ML Engine.
tensor2tensor/serving/serving_utils.py