def __eq__(self, other): if self.shape != _shape(other): return False if self.__origin__ is getattr(other, '__origin__', None): if self.shape != other.shape: return False return all(x == y for (x, y) in zip(self.flat, other.flat)) else: return all(x == y for (x, y) in zip(self, other))
def __abstract_new__(cls, *args, shape=None, dtype=None): """ This function is called when user tries to instantiate an abstract type. It just finds the proper concrete type and instantiate it. """ if dtype is None: dtype = _dtype(args) if shape is None: shape = _shape(args) return cls[shape + (dtype, )](*args)
def __abstract_new__(cls, *args, shape=None, dtype=None): """ This function is called when user tries to instantiate an abstract type. It just finds the proper concrete type and instantiate it. """ if dtype is None: dtype = _dtype(args) if shape is None: shape = _shape(args) return cls[shape + (dtype,)](*args)