Python – tensorflow.math.multiply_no_nan()
TensorFlow是谷歌设计的开源python库,用于开发机器学习模型和深度学习神经网络。 multiply_no_nan()用于寻找明智的x*y元素。它支持广播,如果y是0,即使x是无限的或NaN,也会返回0。
语法: tf.math.multiply_no_nan(x, y, name)
参数 :
- x:它是输入的张量。这个张量允许的dtype是bfloat16, half, float32, float64, uint8, int8, uint16, int16, int32, int64, complex64, complex128。
- y:它是与x相同d类型的输入张量。
- name(可选):它定义了操作的名称。
返回值:
它返回一个与x具有相同dtype的张量。
示例 1:
输出:
例子2:复数乘法
输出: