def _register_numpy_extensions(self):
<EOL>import numpy as np<EOL>numpy_floating_types = (np.float16, np.float32, np.float64)<EOL>if hasattr(np, '<STR_LIT>'):  <EOL><INDENT>numpy_floating_types = numpy_floating_types + (np.float128,)<EOL><DEDENT>@self.add_iterable_check<EOL>def is_object_ndarray(data):<EOL><INDENT>return isinstance(data, np.ndarray) and data.dtype.kind == '<STR_LIT:O>'<EOL><DEDENT>@self.register(np.ndarray)<EOL>def hash_numpy_array(data):<EOL><INDENT>"""<STR_LIT>"""<EOL>if data.dtype.kind == '<STR_LIT:O>':<EOL><INDENT>msg = '<STR_LIT>'<EOL>raise TypeError(msg)<EOL><DEDENT>else:<EOL><INDENT>header = b'<STR_LIT>'.join(_hashable_sequence((len(data.shape), data.shape)))<EOL>dtype = b'<STR_LIT>'.join(_hashable_sequence(data.dtype.descr))<EOL>hashable = header + dtype + data.tobytes()<EOL><DEDENT>prefix = b'<STR_LIT>'<EOL>return prefix, hashable<EOL><DEDENT>@self.register((np.int64, np.int32, np.int16, np.int8) +<EOL>(np.uint64, np.uint32, np.uint16, np.uint8))<EOL>def _hash_numpy_int(data):<EOL><INDENT>return _convert_to_hashable(int(data))<EOL><DEDENT>@self.register(numpy_floating_types)<EOL>def _hash_numpy_float(data):<EOL><INDENT>return _convert_to_hashable(float(data))<EOL><DEDENT>@self.register(np.random.RandomState)<EOL>def _hash_numpy_random_state(data):<EOL><INDENT>"""<STR_LIT>"""<EOL>hashable = b'<STR_LIT>'.join(_hashable_sequence(data.get_state()))<EOL>prefix = b'<STR_LIT>'<EOL>return prefix, hashable<EOL><DEDENT>
Numpy extensions are builtin