Guest User

Untitled

a guest
Jan 19th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. def serving_input_receiver_fn():
  2.  
  3. serialized_tf_example = tf.placeholder(dtype=tf.string, shape=[None], name='input_exapmle_tensor')
  4. receiver_tensors = {"predictor_inputs": serialized_tf_example}
  5.  
  6. feature_spec = {"image": tf.FixedLenFeature((), tf.string)}
  7.  
  8. features = tf.parse_example(serialized_tf_example, feature_spec, example_names='input')
  9.  
  10. return tf.estimator.export.ServingInputReceiver(features, receiver_tensors)
  11.  
  12. predict_output = {
  13. 'pred_output_class': tf.argmax(logits, axis=1),
  14. 'pred_output_prob': tf.nn.softmax(logits, name='softmax_tensor')
  15. }
  16.  
  17. export_output = {'predict_output': tf.estimator.export.PredictOutput(predict_output)}
  18.  
  19. if mode == tf.estimator.ModeKeys.PREDICT:
  20. return tf.estimator.EstimatorSpec(mode=mode, predictions=predictions, export_outputs=export_output)
  21.  
  22. resnet_classifier.export_savedmodel(FLAGS.export_dir, serving_input_receiver_fn)
  23.  
  24. ValueError: Shape must be rank 1 but is rank 0 for 'ParseExample/ParseExample' (op: 'ParseExample') with input shapes: [?], [], [], [0].
Add Comment
Please, Sign In to add comment