Skip to content

jnp.isposinf and float4_e2m1fn don't play well together #381

@gonnet

Description

@gonnet

According to the docs (I'm using v0.5.4), float4_e2m1fn does not support Inf values, and the following

jnp.astype(jnp.inf, jnp.float4_e2m1fn)

produces, as expected, the rounded-down value Array(6, dtype=float4_e2m1fn).

However, if I feed this value to jnp.isposinf, e.g. as a test whether a number format supports +Inf values, i.e.

jnp.isposinf(jnp.astype(jnp.inf, jnp.float4_e2m1fn))

I get the following output:

Array(True, dtype=bool)

which is wrong.

As a workaround, is there any other way to programmatically figure out if a jnp.dtype can represent non-finite values such as Inf or NaN?

Cheers, Pedro

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions