jax-ml / jax-ml/ml_dtypes

bfloat16s (at least) throw error when given a format specifiier

Open
#134 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
361
Forks
60
Avg merge
18h 41m
Merged PRs (30d)
3

Description

```
>>> import jax
>>> jax.__version__
'0.4.21'
>>> from jax.dtypes import bfloat16
>>> f"{bfloat16(1)]}"
'1'
>>> f"{bfloat16(1):.2f}"
Traceback (most recent call last):
File "", line 1, in
ValueError: Unknown format code 'f' for object of type 'str'
```

This is a little surprising to me and, in a larger context, the error message isn't very suggestive about what or where the error is.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the reported bfloat16 formatting examples through the jax.dtypes.bfloat16 entry point, then locate the formatting implementation and its existing tests. Add coverage for the .2f case and verify that the resulting behavior or error clearly identifies the bfloat16 formatting problem.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, python
Domain
machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.