定数を使うべき時がわからないです。
今本で勉強していて、
#coding:UTF-8 from __future__ import absolute_import from __future__ import division from __future__ import print_function import tensorflow as tf const1 = tf.constant(2) const2 = tf.constant(3) add_op = tf.add(const1,const2) with tf.Session() as sess: result = sess.run(add_op) print(result)
というコードが出て来たのですが
このコードの
const1 = tf.constant(2) const2 = tf.constant(3)
のconstantでわざわざ定数にするメソッドを使っている意味がわかりません。
変数として代入してもいいと思うのですが...。
また、tensorflowでこのtf.constant()を使う時はどういうケースがあるのでしょうか?
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。