tf.compat.v1.to_complex64
Преобразует тензор в тип complex64. (устарело)
tf.compat.v1.to_complex64(
x, name='ToComplex64'
)
Переход на TF2
Это имя устарело и было удалено в TF2, но для него есть точная замена tf.cast(..., tf.complex64). При eager execution или 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 | Tensor, SparseTensor или IndexedSlices. |
name | Имя операции (необязательно). |
| Возвращает | |
|---|---|
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/api_docs/python/tf/compat/v1/to_complex64