I've noticed every example on TensorFlow Serving uses legacy_init_op
parameter in SavedModelBuilder
but I have not found any clear explanations on what this is and why it is called legacy. Anyone knows the purpose of this argument?
Example:
legacy_init_op = tf.group(tf.tables_initializer(), name='legacy_init_op')
builder.add_meta_graph_and_variables(
sess, [tf.saved_model.tag_constants.SERVING],
signature_def_map={
'predict_images':
prediction_signature,
tf.saved_model.signature_constants.DEFAULT_SERVING_SIGNATURE_DEF_KEY:
classification_signature,
},
legacy_init_op=legacy_init_op)
Tensorflow Serving uses lookup tables for embedding or vocabulary lookups. Previous version of tf < 1.2 initialization of tables need a separate op. So you need to use the tf.tables_initializer()
separately to init the tables. In future version that operation will be combined within the ModelBundle.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With