tf.math.reciprocal_no_nan
Выполняет безопасное поэлементное вычисление обратной величины.
tf.math.reciprocal_no_nan(
x, name=None
)
Если значение какого-либо элемента равно нулю, обратная величина этого элемента также устанавливается в ноль.
Например:
x = tf.constant([2.0, 0.5, 0, 1], dtype=tf.float32) tf.math.reciprocal_no_nan(x) # [ 0.5, 2, 0.0, 1.0 ]
| Аргументы | |
|---|---|
x | A Tensor of type float16, float32, float64 complex64 or complex128. |
name | Имя операции (необязательно). |
| Возвращает | |
|---|---|
A Tensor of same shape and type as x. |
| Вызывает исключение | |
|---|---|
TypeError | 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/reciprocal_no_nan