In Tensorflow for serving a model, what does the serving input function supposed to do exactly

后端 未结 2 1842
后悔当初
后悔当初 2020-12-09 13:27

So, I\'ve been struggling to understand what the main task of a serving_input_fn() is when a trained model is exported in Tensorflow for serving purposes. There are some exa

2条回答
  •  误落风尘
    2020-12-09 14:12

    If you are writing a custom Estimator, the serving input function remains the same as above. That is still the input to predict().

    What changes is that you have to write a predictions dictionary for the output and specify it when creating an EstimatorSpec

    Take a look at the serving input function in model.py and the sequence_regressor in task.py in this directory:

    https://github.com/GoogleCloudPlatform/training-data-analyst/tree/master/courses/machine_learning/deepdive/09_sequence/sinemodel/trainer

    That is an example of a custom regression model that takes N inputs and has one output.

提交回复
热议问题