tf.compat.v1.to_double
Преобразование тензора к типу float64. (устарело)
tf.compat.v1.to_double(
x, name='ToDouble'
)
Переход на TF2
Это имя было устарело и удалено в TF2, но имеет точное замещение tf.cast(..., tf.double). Не возникает проблем с выполнением eager или tf.function.
До:
tf.compat.v1.to_double(tf.constant(3.14, dtype=tf.float32)) <tf.Tensor: shape=(), dtype=float64, numpy=3.14>
После:
tf.cast(tf.constant(3.14, dtype=tf.float32), tf.double) <tf.Tensor: shape=(), dtype=float64, numpy=3.14>
Описание
| Аргументы | |
|---|---|
x | Tensor или SparseTensor или IndexedSlices. |
name | Имя операции (необязательно). |
| Возвращаемое значение | |
|---|---|
Tensor или SparseTensor или IndexedSlices с той же формой, что и x, но с типом float64. |
| Исключения | |
|---|---|
TypeError | Если x нельзя привести к типу float64. |
© 2022 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 4.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/api_docs/python/tf/compat/v1/to_double