The docs say:
In addition, variants of these types with the _ref suffix are defined for reference-typed tensors.
What exactly does this mean? What are reference-typed tensors and how do they differ from standard ones?
The docs say:
In addition, variants of these types with the _ref suffix are defined for reference-typed tensors.
What exactly does this mean? What are reference-typed tensors and how do they differ from standard ones?
A reference-typed tensor is mutable. The most common way to create a reference-typed tensor is to define a tf.Variable
: defining a tf.Variable
whose initial value has dtype tf.float32
will create a reference-typed tensor with dtype tf.float32_ref
. You can mutate a reference-typed tensor by passing it as the first argument to tf.assign()
.
(Note that reference-typed tensors are something of an implementation detail in the present version of TensorFlow. We'd encourage you to use higher-level wrappers like tf.Variable
, which may migrate to alternative representations for mutable state in the future.)