TensorFlow是Google设计的开源Python库,用于开发机器学习模型和深度学习神经网络。
如果 x 是 strictly-increasing,则 is_strictly_increasing() 返回真。如果 x 少于 2 个元素,则它是简单地严格递增的。 Row Major 用于比较元素。
用法:tensorflow.math.is_strictly_increasing( x, name)
参数:
- x:它是一个数字张量。
- name(optional):它定义了操作的名称
返回值:它返回一个 dtype bool 的张量。
范例1:
Python3
# importing the library
import tensorflow as tf
# Initializing the input tensor
a = tf.constant([2, 3, 3, 5], dtype = tf.float64)
# Printing the input tensor
print('a:', a)
# Calculating the result
res = tf.math.is_strictly_increasing(a)
# Printing the result
print('Result:', res)
输出:
a: tf.Tensor([2. 3. 3. 5.], shape=(4, ), dtype=float64) Result: tf.Tensor(False, shape=(), dtype=bool)
范例2:
Python3
# Importing the library
import tensorflow as tf
# Initializing the input tensor
a = tf.constant([7, 8, 13, 17], dtype = tf.float64)
# Printing the input tensor
print('a:', a)
# Calculating the result
res = tf.math.is_strictly_increasing(a)
# Printing the result
print('Result:', res)
输出:
a: tf.Tensor([ 7. 8. 13. 17.], shape=(4, ), dtype=float64) Result: tf.Tensor(True, shape=(), dtype=bool)
注:本文由纯净天空筛选整理自aman neekhara大神的英文原创作品 Python – tensorflow.math.is_strictly_increasing()。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。