Python – tensorflow.math.is_finite()
TensorFlow是谷歌设计的开源Python库,用于开发机器学习模型和深度学习神经网络。
is_finite()用于检查x的元素有限性。
语法: tensorflow.math.is_finite( x, name)
参数:
- x:它是一个张量。允许的d类型是bfloat16, half, float32, float64。
- name(可选):它定义了该操作的名称
返回:它返回一个dtype bool的张量。
实例1:本实例使用numpy inf并检查其有限性。
输出:
实例2:本实例使用numpy nan并检查其有限性。
输出: