Skip to content

Commit f16d3b4

Browse files
committed
docs
1 parent c8c43f3 commit f16d3b4

File tree

4 files changed

+36
-7
lines changed

4 files changed

+36
-7
lines changed

docs/source/api.rst

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,22 @@ API
55

66
.. module:: gfloat
77

8-
Functions
9-
---------
8+
Scalar Functions
9+
----------------
1010

1111
.. autofunction:: decode_float
1212
.. autofunction:: round_float
1313
.. autofunction:: encode_float
1414

15+
Block format functions
16+
----------------------
17+
1518
.. autofunction:: decode_block
1619
.. autofunction:: encode_block
20+
.. autofunction:: quantize_block
21+
22+
.. autofunction:: compute_scale_amax
23+
1724

1825
Classes
1926
-------

docs/source/conf.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,16 @@
2424
"myst_nb",
2525
]
2626

27+
autodoc_typehints = "none" # We have them in the parameter descriptors
28+
autodoc_typehints_format = "short"
29+
python_use_unqualified_type_names = True
30+
31+
autodoc_type_aliases = {
32+
"Iterable": "Iterable",
33+
"npt.ArrayLike": "zArrayLike",
34+
"npt.NDArray": "zNDArray",
35+
}
36+
2737
autodoc_default_options = {
2838
"member-order": "bysource",
2939
}

docs/source/formats.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,14 @@ IEEE WG P3109 Formats
3131
---------------------
3232

3333
.. autofunction:: format_info_p3109
34+
35+
Block Formats
36+
---------------------
37+
38+
.. autodata:: format_info_mxfp8_e5m2
39+
.. autodata:: format_info_mxfp8_e4m3
40+
.. autodata:: format_info_mxfp6_e3m2
41+
.. autodata:: format_info_mxfp6_e2m3
42+
.. autodata:: format_info_mxfp4_e2m1
43+
.. autodata:: format_info_mxfp4_e2m1
44+
.. autodata:: format_info_mxint8

src/gfloat/block.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def encode_block(
9595
The :paramref:`scale` is explicitly passed, and the :paramref:`vals` are
9696
assumed to already be multiplied by `1/scale`.
9797
That is, this is pure encoding, scaling is computed and applied elsewhere
98-
(see e.g. :funcref:`quantize_block`).
98+
(see e.g. :func:`quantize_block`).
9999
100100
It is checked for overflow in the target format,
101101
and will raise an exception if it does.
@@ -137,7 +137,7 @@ def compute_scale_amax(etype_emax: float, vals: npt.ArrayLike) -> float:
137137
138138
Args:
139139
etype_emax (float): Maximum exponent to appear in `vals * scale`
140-
vals (numpy.array): Input block
140+
vals (ArrayLike): Input block
141141
142142
Returns:
143143
A float such that `vals * scale` has exponents less than or equal to `etype_emax`.
@@ -160,13 +160,14 @@ def quantize_block(
160160
round: RoundMode = RoundMode.TiesToEven,
161161
) -> npt.NDArray[np.float64]:
162162
"""
163-
Encode and decode a block of :paramref:`vals` of bytes into block Format descibed by :paramref:`fi`
163+
Encode and decode a block of :paramref:`vals` of bytes into
164+
block format descibed by :paramref:`fi`
164165
165166
Args:
166167
fi (BlockFormatInfo): Describes the target block format
167168
vals (numpy.array): Input block
168-
compute_scale ((float, np.array) -> float):
169-
Callable to compute the scale
169+
compute_scale ((float, ArrayLike) -> float):
170+
Callable to compute the scale, defaults to :func:`compute_scale_amax`
170171
round (RoundMode): Rounding mode to use, defaults to `TiesToEven`
171172
172173
Returns:

0 commit comments

Comments
 (0)