示例#1
0
 def nan_reduction(a, axis=None, dtype=None, keepdims=False):
     a = array_ops.array(a)
     v = array_ops.array(init_val, dtype=a.dtype)
     return reduction(array_ops.where(isnan(a), v, a),
                      axis=axis,
                      dtype=dtype,
                      keepdims=keepdims)
示例#2
0
def logaddexp2(x1, x2):
    amax = maximum(x1, x2)
    delta = x1 - x2
    return array_ops.where(
        isnan(delta),
        x1 + x2,  # NaNs or infinities of the same sign.
        amax + log1p(exp2(-abs(delta))) / np.log(2))
示例#3
0
 def testWhere(self):
     self.assertAllEqual([[1.0, 1.0], [1.0, 1.0]],
                         array_ops.where([True], [1.0, 1.0],
                                         [[0, 0], [0, 0]]))