-
In PyTorch, one can use Blindly using
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You can use dt = jnp.dtype('int8')
isinstance(dt, jnp.dtype) # True Where it gets confusing is that If you are hoping to work explicitly with dtypes, you can always cast scalar constructors to dtypes using something like |
Beta Was this translation helpful? Give feedback.
You can use
isinstance(thing, jnp.dtype)
if you have a dtype; for example:Where it gets confusing is that
jnp.int8
is not a dtype, it is a scalar constructor. JAX inherits this behavior from NumPy, wherenumpy.dtype('int8')
is a dtype, whilenumpy.int8
is a scalar constructor which is not an instance of dtype.If you are hoping to work explicitly with dtypes, you can always cast scalar constructors to dtypes using something like
jnp.dtype(jnp.int8)
; if that doesn't help then perhaps you could share more about the problem you're trying to solve.