if not isinstance(self.dtype, str):
raise ValueError('{!r} != {!r}'.format(type(self.dtype), str))
# replace buildin type with numpy type name
if self.dtype in buildin_type_aliases:
self.dtype = replacement_type[buildin_type_aliases.index(self.dtype)]
if not hasattr(np, self.dtype):
raise ValueError('Invalid dtype str: {!r}'.format(self.type))
and this seems also to work for me. However, it will not work when hasattr(tf, self.dtype) is executed (this is mentioned in the doc string but I can not find it anywhere in the repo.
Calling
with, e.g.,
int
orbool
raises the error. Also see https://numpy.org/devdocs/release/1.20.0-notes.html#deprecationsI thought a solution could be something like:
and
and this seems also to work for me. However, it will not work when
hasattr(tf, self.dtype)
is executed (this is mentioned in the doc string but I can not find it anywhere in the repo.