1. 程式人生 > >tf.enable_eager_execution() 小例項

tf.enable_eager_execution() 小例項

import tensorflow as tf

ones = tf.ones(shape=[3,3])
print(ones)

Tensor(“ones:0”, shape=(3, 3), dtype=float32)

import tensorflow as tf
tf.enable_eager_execution()
ones = tf.ones(shape=[3,3])
print(ones)

tf.Tensor(
[[1. 1. 1.]
[1. 1. 1.]
[1. 1. 1.]], shape=(3, 3), dtype=float32)