def verify_meta(self, value, meta, stats): assert isinstance(value, np.ndarray) if meta["dtype"] != str(value.dtype): raise VerificationError("dtype mismatch") if meta["shape"] != value.shape: raise VerificationError("shape mismatch") if "vhash" in meta: key, algo = meta["vhash"] if (key, algo) != ndarray_hash.ndarray_hash(x, algo): raise VerificationError("hash mismatch")
def infer_meta(self, x): return dict(dtype=str(x.dtype), shape=x.shape, vhash=ndarray_hash.ndarray_hash(x, self._algo))