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

前端 未结 14 895
余生分开走
余生分开走 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:21

    For TF V1:

    1. Constant is with initial value and it won't change in the computation;

    2. Variable is with initial value and it can change in the computation; (so good for parameters)

    3. Placeholder is without initial value and it won't change in the computation. (so good for inputs like prediction instances)

    For TF V2, same but they try to hide Placeholder (graph mode is not preferred).

提交回复
热议问题