MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / is_non_decreasing

Function is_non_decreasing

tensorflow/python/ops/check_ops.py:1907–1930  ·  view source on GitHub ↗

Returns `True` if `x` is non-decreasing. Elements of `x` are compared in row-major order. The tensor `[x[0],...]` is non-decreasing if for every adjacent pair we have `x[i] <= x[i+1]`. If `x` has less than two elements, it is trivially non-decreasing. See also: `is_strictly_increasing`

(x, name=None)

Source from the content-addressed store, hash-verified

1905@deprecation.deprecated_endpoints('debugging.is_non_decreasing',
1906 'is_non_decreasing')
1907def is_non_decreasing(x, name=None):
1908 """Returns `True` if `x` is non-decreasing.
1909
1910 Elements of `x` are compared in row-major order. The tensor `[x[0],...]`
1911 is non-decreasing if for every adjacent pair we have `x[i] <= x[i+1]`.
1912 If `x` has less than two elements, it is trivially non-decreasing.
1913
1914 See also: `is_strictly_increasing`
1915
1916 Args:
1917 x: Numeric `Tensor`.
1918 name: A name for this operation (optional). Defaults to "is_non_decreasing"
1919
1920 Returns:
1921 Boolean `Tensor`, equal to `True` iff `x` is non-decreasing.
1922
1923 Raises:
1924 TypeError: if `x` is not a numeric tensor.
1925 """
1926 with ops.name_scope(name, 'is_non_decreasing', [x]):
1927 diff = _get_diff_for_monotonic_comparison(x)
1928 # When len(x) = 1, diff = [], less_equal = [], and reduce_all([]) = True.
1929 zero = ops.convert_to_tensor(0, dtype=diff.dtype)
1930 return math_ops.reduce_all(math_ops.less_equal(zero, diff))
1931
1932
1933@tf_export(

Callers

nothing calls this directly

Calls 2

name_scopeMethod · 0.45

Tested by

no test coverage detected