In Tensorflow, what is the difference between a tensor that has a type ending in _ref and a tensor that does not?

前端 未结 1 1677
再見小時候
再見小時候 2020-12-14 11:14

The docs say:

In addition, variants of these types with the _ref suffix are defined for reference-typed tensors.

What exactly

相关标签:
1条回答
  • 2020-12-14 11:32

    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.)

    0 讨论(0)
提交回复
热议问题