tf.math.sqrt
Вычисляет квадратный корень входного тензора поэлементно.
tf.math.sqrt(
x, name=None
)
Используется в блокнотах
| Используется в руководстве | Используется в учебниках |
|---|---|
Примечание: Эта операция не поддерживает целочисленные типы.
x = tf.constant([[4.0], [16.0]])
tf.sqrt(x)
<tf.Tensor: shape=(2, 1), dtype=float32, numpy=
array([[2.],
[4.]], dtype=float32)>
y = tf.constant([[-4.0], [16.0]])
tf.sqrt(y)
<tf.Tensor: shape=(2, 1), dtype=float32, numpy=
array([[nan],
[ 4.]], dtype=float32)>
z = tf.constant([[-1.0], [16.0]], dtype=tf.complex128)
tf.sqrt(z)
<tf.Tensor: shape=(2, 1), dtype=complex128, numpy=
array([[0.0+1.j],
[4.0+0.j]])>Примечание: Для поддержки комплексных типов, пожалуйста, предоставьте входной тензор типаcomplex64илиcomplex128.
| Аргументы | |
|---|---|
x | tf.Tensor типа bfloat16, half, float32, float64, complex64, complex128 |
name | Имя операции (необязательно). |
| Возвращаемое значение | |
|---|---|
tf.Tensor тех же размеров, типа и разреженности, что и x. Если |
© 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/math/sqrt