tf.compat.v1.to_complex64
Преобразование тензора к типу complex64. (устарело)
tf.compat.v1.to_complex64(
x, name='ToComplex64'
)
Переход на TF2
Это имя было устарело и удалено в TF2, но имеет точную замену tf.cast(..., tf.complex64). Нет дальнейших проблем с выполнением eager или tf.function.
Ранее:
tf.compat.v1.to_complex64(tf.constant(1. + 2.j, dtype=tf.complex128)) <tf.Tensor: shape=(), dtype=complex64, numpy=(1+2j)>
После:
tf.cast(tf.constant(1. + 2.j, dtype=tf.complex128), tf.complex64) <tf.Tensor: shape=(), dtype=complex64, numpy=(1+2j)>
Описание
| Аргументы | |
|---|---|
x | A Tensor или SparseTensor или IndexedSlices. |
name | Имя операции (необязательно). |
| Возвращаемое значение | |
|---|---|
A Tensor или SparseTensor или IndexedSlices с той же формой, что и x с типом complex64. |
| Возбуждаемые исключения | |
|---|---|
TypeError | Если x не может быть преобразован в complex64. |
© 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/versions/r2.9/api_docs/python/tf/compat/v1/to_complex64