Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

legacy_init_op in TensorFlow Serving

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)
like image 494
Kirill Dubovikov Avatar asked Aug 05 '17 11:08

Kirill Dubovikov


Video Answer


1 Answers

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.

like image 177
Ishant Mrinal Avatar answered Sep 28 '22 01:09

Ishant Mrinal