访问量: 10 次浏览
tensorflow.math.is\_strictly\_increasing()TensorFlow是谷歌设计的开源Python库,用于开发机器学习模型和深度学习神经网络。
is\_strictly\_increasing()如果x是严格递增的,则返回true。如果x的元素少于2个,它就是严格递增的。行大是用来比较元素的。
语法:
tensorflow.math.is_strictly_increasing( x, name)
参数:
返回:它返回一个dtype bool的张量。
示例 1:
# 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:
# 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)