示例#1
0
文件: type.py 项目: aalmah/Theano
    def values_eq(a, b):
        if a.shape != b.shape:
            return False
        if a.typecode != b.typecode:
            return False
        a_eq_b = numpy.asarray(compare(a, '==', b))
        if a_eq_b.all():
            return True

        # maybe the trouble is that there are NaNs
        a = numpy.asarray(a)
        b = numpy.asarray(b)

        a_missing = numpy.isnan(a)
        if a_missing.any():
            b_missing = numpy.isnan(b)
            return numpy.all(a_eq_b + (a_missing == b_missing))
        else:
            return False
示例#2
0
    def values_eq(a, b, force_same_dtype=True):
        if a.shape != b.shape:
            return False
        if force_same_dtype and a.typecode != b.typecode:
            return False
        a_eq_b = np.asarray(compare(a, '==', b))
        if a_eq_b.all():
            return True

        # maybe the trouble is that there are NaNs
        a = np.asarray(a)
        b = np.asarray(b)

        a_missing = np.isnan(a)
        if a_missing.any():
            b_missing = np.isnan(b)
            return np.all(a_eq_b + (a_missing == b_missing))
        else:
            return False
示例#3
0
 def values_eq(a, b):
     if a.shape != b.shape:
         return False
     if a.typecode != b.typecode:
         return False
     return numpy.asarray(compare(a, '==', b)).all()
示例#4
0
 def values_eq(a, b):
     if a.shape != b.shape:
         return False
     if a.typecode != b.typecode:
         return False
     return numpy.asarray(compare(a, '==', b)).all()