在Tensorflow 2.0中,我们看到的主要“张量”实际上是EagerTensors
(tensorflow.python.framework.ops.EagerTensor
更准确地说):
x = [[2.]]
m = tf.matmul(x, x)
type(m)
# returns tensorflow.python.framework.ops.EagerTensor
但是,在某些情况下,我们有符号Tensor
对象(tensorflow.python.framework.ops.Tensor
),如TF1.X所示。
例如,在keras中:
那么,这些符号在Tensorflow中的用法是什么呢
嗯,是的。你的直觉是正确的。}表示图中可能尚未计算的张量节点。在
EagreTensor
表示一个张量,该张量的值已在eager模式下计算,而{好吧,在某种程度上,我们一直在使用它们。我们创建keras模型,tf.data.Dataset但是,实际上,对于绝大多数用例,我们并不倾向于实例化或直接与
Tensor
对象本身交互,所以可能只想不必担心对象类型,而将其视为tensorflow内部的实现细节。在相关问题 更多 >
编程相关推荐