3

I am deploying my tf model to android, and I just want to ask what are considered as 'const op' in tf? Also, if your going to save you variables into a checkpoint and be saved into an optimized file that will be used in an android app, should you explicitly name all of them? Or does tf automatically assigns a name for all the variables?

Chaine
  • 1,368
  • 4
  • 18
  • 37

1 Answers1

2

What is 'Const Op' in Tensorflow?

This is an op that manages constants created with tf.constant (or similar function in another language). Basically, it's just a constant tensor.

Or does tf automatically assigns a name for all the variables?

Tensorflow automatically gives names to the variables, but you should better give the names to those variables that you care about to find them easily later on. Automatic names can be sometimes cryptic and misleading. For instance, gru_def/rnn/gru_cell/gates/kernel is one of the variables inside a GRU cell and most of the scopes are defined with the library, not in your code.

Or, you might see Placeholder_1 and think that this is the first placeholder in your model, but it would be wrong, because the true first placeholder is Placeholder, while Placeholder_1 is the second one (in fact, that was a real bug).

Maxim
  • 52,561
  • 27
  • 155
  • 209
  • Got it! But other than convenience when trying to reload these variables, is it necessary if you are deploying your model to android? Or you can just assign explicitly only the names of the input and the output? – Chaine Jan 07 '18 at 16:21
  • 1
    Assigning names is optional, meaning that the model *will* work. But it is recommended, especially for inputs and outputs to save you from bugs – Maxim Jan 07 '18 at 16:22
  • So you mean to say I only need to assign input and output names, when developing an android app? – Chaine Jan 07 '18 at 16:38
  • 1
    Yes. Actually, there's one more reason to give explicit names: if you want to inspect your model in tensorboard. – Maxim Jan 07 '18 at 16:42
  • Okay! Thank you! – Chaine Jan 07 '18 at 16:51
  • Hi, I'd be happy if you'd answer this as well https://stackoverflow.com/questions/48241879/restoring-variables-in-tensorflow – Chaine Jan 13 '18 at 16:38