What's the difference between tf.placeholder and tf.Variable?

前端 未结 14 869
余生分开走
余生分开走 2020-12-07 06:33

I\'m a newbie to TensorFlow. I\'m confused about the difference between tf.placeholder and tf.Variable. In my view, tf.placeholder is

14条回答
  •  一生所求
    2020-12-07 07:26

    Tensorflow 2.0 Compatible Answer: The concept of Placeholders, tf.placeholder will not be available in Tensorflow 2.x (>= 2.0) by default, as the Default Execution Mode is Eager Execution.

    However, we can use them if used in Graph Mode (Disable Eager Execution).

    Equivalent command for TF Placeholder in version 2.x is tf.compat.v1.placeholder.

    Equivalent Command for TF Variable in version 2.x is tf.Variable and if you want to migrate the code from 1.x to 2.x, the equivalent command is

    tf.compat.v2.Variable.

    Please refer this Tensorflow Page for more information about Tensorflow Version 2.0.

    Please refer the Migration Guide for more information about migration from versions 1.x to 2.x.

提交回复
热议问题