我们可以更改张量流常量值吗?

时间:2020-05-24 06:13:49

标签: tensorflow

我读到恒定的张量流值不能更改。 那么下面的代码是如何工作的。

import tensorflow as tf


x = tf.constant(35, name='x')
y = tf.constant( 5, name='y')

y = tf.constant( 2, name='y')

with tf.Session() as session:
    print(session.run(y))
y = tf.constant( 7, name='y')
with tf.Session() as session:
    print(session.run(y))

它应该给出一个错误。

0 个答案:

没有答案