tf.math.is_non_decreasing
Возвращает True, если x не убывает.
tf.math.is_non_decreasing(
x, name=None
)
Элементы x сравниваются в построчном порядке. Тензор [x[0],...] не убывает, если для каждой соседней пары выполняется x[i] <= x[i+1]. Если x содержит менее двух элементов, он тривиально не убывает.
См. также: is_strictly_increasing
x1 = tf.constant([1.0, 1.0, 3.0]) tf.math.is_non_decreasing(x1) <tf.Tensor: shape=(), dtype=bool, numpy=True> x2 = tf.constant([3.0, 1.0, 2.0]) tf.math.is_non_decreasing(x2) <tf.Tensor: shape=(), dtype=bool, numpy=False>
| Аргументы | |
|---|---|
x | Числовой Tensor. |
name | Имя этой операции (необязательно). По умолчанию — "is_non_decreasing" |
| Возвращает | |
|---|---|
Логический Tensor, равный True тогда и только тогда, когда 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/is_non_decreasing