About float 8#

Float 8 types were recently introduced to speed up the training of deep learning models.

Possible values#

First E4M3FN.

import pprint
from onnx_array_api.validation.f8 import CastFloat8

pprint.pprint(CastFloat8.values_e4m3fn)
[(-448.0, 254),
 (-416.0, 253),
 (-384.0, 252),
 (-352.0, 251),
 (-320.0, 250),
 (-288.0, 249),
 (-256.0, 248),
 (-240.0, 247),
 (-224.0, 246),
 (-208.0, 245),
 (-192.0, 244),
 (-176.0, 243),
 (-160.0, 242),
 (-144.0, 241),
 (-128.0, 240),
 (-120.0, 239),
 (-112.0, 238),
 (-104.0, 237),
 (-96.0, 236),
 (-88.0, 235),
 (-80.0, 234),
 (-72.0, 233),
 (-64.0, 232),
 (-60.0, 231),
 (-56.0, 230),
 (-52.0, 229),
 (-48.0, 228),
 (-44.0, 227),
 (-40.0, 226),
 (-36.0, 225),
 (-32.0, 224),
 (-30.0, 223),
 (-28.0, 222),
 (-26.0, 221),
 (-24.0, 220),
 (-22.0, 219),
 (-20.0, 218),
 (-18.0, 217),
 (-16.0, 216),
 (-15.0, 215),
 (-14.0, 214),
 (-13.0, 213),
 (-12.0, 212),
 (-11.0, 211),
 (-10.0, 210),
 (-9.0, 209),
 (-8.0, 208),
 (-7.5, 207),
 (-7.0, 206),
 (-6.5, 205),
 (-6.0, 204),
 (-5.5, 203),
 (-5.0, 202),
 (-4.5, 201),
 (-4.0, 200),
 (-3.75, 199),
 (-3.5, 198),
 (-3.25, 197),
 (-3.0, 196),
 (-2.75, 195),
 (-2.5, 194),
 (-2.25, 193),
 (-2.0, 192),
 (-1.875, 191),
 (-1.75, 190),
 (-1.625, 189),
 (-1.5, 188),
 (-1.375, 187),
 (-1.25, 186),
 (-1.125, 185),
 (-1.0, 184),
 (-0.9375, 183),
 (-0.875, 182),
 (-0.8125, 181),
 (-0.75, 180),
 (-0.6875, 179),
 (-0.625, 178),
 (-0.5625, 177),
 (-0.5, 176),
 (-0.46875, 175),
 (-0.4375, 174),
 (-0.40625, 173),
 (-0.375, 172),
 (-0.34375, 171),
 (-0.3125, 170),
 (-0.28125, 169),
 (-0.25, 168),
 (-0.234375, 167),
 (-0.21875, 166),
 (-0.203125, 165),
 (-0.1875, 164),
 (-0.171875, 163),
 (-0.15625, 162),
 (-0.140625, 161),
 (-0.125, 160),
 (-0.1171875, 159),
 (-0.109375, 158),
 (-0.1015625, 157),
 (-0.09375, 156),
 (-0.0859375, 155),
 (-0.078125, 154),
 (-0.0703125, 153),
 (-0.0625, 152),
 (-0.05859375, 151),
 (-0.0546875, 150),
 (-0.05078125, 149),
 (-0.046875, 148),
 (-0.04296875, 147),
 (-0.0390625, 146),
 (-0.03515625, 145),
 (-0.03125, 144),
 (-0.029296875, 143),
 (-0.02734375, 142),
 (-0.025390625, 141),
 (-0.0234375, 140),
 (-0.021484375, 139),
 (-0.01953125, 138),
 (-0.017578125, 137),
 (-0.015625, 136),
 (-0.013671875, 135),
 (-0.01171875, 134),
 (-0.009765625, 133),
 (-0.0078125, 132),
 (-0.005859375, 131),
 (-0.00390625, 130),
 (-0.001953125, 129),
 (0.0, 0),
 (-0.0, 128),
 (0.001953125, 1),
 (0.00390625, 2),
 (0.005859375, 3),
 (0.0078125, 4),
 (0.009765625, 5),
 (0.01171875, 6),
 (0.013671875, 7),
 (0.015625, 8),
 (0.017578125, 9),
 (0.01953125, 10),
 (0.021484375, 11),
 (0.0234375, 12),
 (0.025390625, 13),
 (0.02734375, 14),
 (0.029296875, 15),
 (0.03125, 16),
 (0.03515625, 17),
 (0.0390625, 18),
 (0.04296875, 19),
 (0.046875, 20),
 (0.05078125, 21),
 (0.0546875, 22),
 (0.05859375, 23),
 (0.0625, 24),
 (0.0703125, 25),
 (0.078125, 26),
 (0.0859375, 27),
 (0.09375, 28),
 (0.1015625, 29),
 (0.109375, 30),
 (0.1171875, 31),
 (0.125, 32),
 (0.140625, 33),
 (0.15625, 34),
 (0.171875, 35),
 (0.1875, 36),
 (0.203125, 37),
 (0.21875, 38),
 (0.234375, 39),
 (0.25, 40),
 (0.28125, 41),
 (0.3125, 42),
 (0.34375, 43),
 (0.375, 44),
 (0.40625, 45),
 (0.4375, 46),
 (0.46875, 47),
 (0.5, 48),
 (0.5625, 49),
 (0.625, 50),
 (0.6875, 51),
 (0.75, 52),
 (0.8125, 53),
 (0.875, 54),
 (0.9375, 55),
 (1.0, 56),
 (1.125, 57),
 (1.25, 58),
 (1.375, 59),
 (1.5, 60),
 (1.625, 61),
 (1.75, 62),
 (1.875, 63),
 (2.0, 64),
 (2.25, 65),
 (2.5, 66),
 (2.75, 67),
 (3.0, 68),
 (3.25, 69),
 (3.5, 70),
 (3.75, 71),
 (4.0, 72),
 (4.5, 73),
 (5.0, 74),
 (5.5, 75),
 (6.0, 76),
 (6.5, 77),
 (7.0, 78),
 (7.5, 79),
 (8.0, 80),
 (9.0, 81),
 (10.0, 82),
 (11.0, 83),
 (12.0, 84),
 (13.0, 85),
 (14.0, 86),
 (15.0, 87),
 (16.0, 88),
 (18.0, 89),
 (20.0, 90),
 (22.0, 91),
 (24.0, 92),
 (26.0, 93),
 (28.0, 94),
 (30.0, 95),
 (32.0, 96),
 (36.0, 97),
 (40.0, 98),
 (44.0, 99),
 (48.0, 100),
 (52.0, 101),
 (56.0, 102),
 (60.0, 103),
 (64.0, 104),
 (72.0, 105),
 (80.0, 106),
 (88.0, 107),
 (96.0, 108),
 (104.0, 109),
 (112.0, 110),
 (120.0, 111),
 (128.0, 112),
 (144.0, 113),
 (160.0, 114),
 (176.0, 115),
 (192.0, 116),
 (208.0, 117),
 (224.0, 118),
 (240.0, 119),
 (256.0, 120),
 (288.0, 121),
 (320.0, 122),
 (352.0, 123),
 (384.0, 124),
 (416.0, 125),
 (448.0, 126)]

Then E5M2.

[(-inf, 252),
 (-57344.0, 251),
 (-49152.0, 250),
 (-40960.0, 249),
 (-32768.0, 248),
 (-28672.0, 247),
 (-24576.0, 246),
 (-20480.0, 245),
 (-16384.0, 244),
 (-14336.0, 243),
 (-12288.0, 242),
 (-10240.0, 241),
 (-8192.0, 240),
 (-7168.0, 239),
 (-6144.0, 238),
 (-5120.0, 237),
 (-4096.0, 236),
 (-3584.0, 235),
 (-3072.0, 234),
 (-2560.0, 233),
 (-2048.0, 232),
 (-1792.0, 231),
 (-1536.0, 230),
 (-1280.0, 229),
 (-1024.0, 228),
 (-896.0, 227),
 (-768.0, 226),
 (-640.0, 225),
 (-512.0, 224),
 (-448.0, 223),
 (-384.0, 222),
 (-320.0, 221),
 (-256.0, 220),
 (-224.0, 219),
 (-192.0, 218),
 (-160.0, 217),
 (-128.0, 216),
 (-112.0, 215),
 (-96.0, 214),
 (-80.0, 213),
 (-64.0, 212),
 (-56.0, 211),
 (-48.0, 210),
 (-40.0, 209),
 (-32.0, 208),
 (-28.0, 207),
 (-24.0, 206),
 (-20.0, 205),
 (-16.0, 204),
 (-14.0, 203),
 (-12.0, 202),
 (-10.0, 201),
 (-8.0, 200),
 (-7.0, 199),
 (-6.0, 198),
 (-5.0, 197),
 (-4.0, 196),
 (-3.5, 195),
 (-3.0, 194),
 (-2.5, 193),
 (-2.0, 192),
 (-1.75, 191),
 (-1.5, 190),
 (-1.25, 189),
 (-1.0, 188),
 (-0.875, 187),
 (-0.75, 186),
 (-0.625, 185),
 (-0.5, 184),
 (-0.4375, 183),
 (-0.375, 182),
 (-0.3125, 181),
 (-0.25, 180),
 (-0.21875, 179),
 (-0.1875, 178),
 (-0.15625, 177),
 (-0.125, 176),
 (-0.109375, 175),
 (-0.09375, 174),
 (-0.078125, 173),
 (-0.0625, 172),
 (-0.0546875, 171),
 (-0.046875, 170),
 (-0.0390625, 169),
 (-0.03125, 168),
 (-0.02734375, 167),
 (-0.0234375, 166),
 (-0.01953125, 165),
 (-0.015625, 164),
 (-0.013671875, 163),
 (-0.01171875, 162),
 (-0.009765625, 161),
 (-0.0078125, 160),
 (-0.0068359375, 159),
 (-0.005859375, 158),
 (-0.0048828125, 157),
 (-0.00390625, 156),
 (-0.0034179688, 155),
 (-0.0029296875, 154),
 (-0.0024414062, 153),
 (-0.001953125, 152),
 (-0.0017089844, 151),
 (-0.0014648438, 150),
 (-0.0012207031, 149),
 (-0.0009765625, 148),
 (-0.0008544922, 147),
 (-0.0007324219, 146),
 (-0.00061035156, 145),
 (-0.00048828125, 144),
 (-0.0004272461, 143),
 (-0.00036621094, 142),
 (-0.00030517578, 141),
 (-0.00024414062, 140),
 (-0.00021362305, 139),
 (-0.00018310547, 138),
 (-0.00015258789, 137),
 (-0.00012207031, 136),
 (-0.00010681152, 135),
 (-9.1552734e-05, 134),
 (-7.6293945e-05, 133),
 (-6.1035156e-05, 132),
 (-4.5776367e-05, 131),
 (-3.0517578e-05, 130),
 (-1.5258789e-05, 129),
 (0.0, 0),
 (0.0, 128),
 (1.5258789e-05, 1),
 (3.0517578e-05, 2),
 (4.5776367e-05, 3),
 (6.1035156e-05, 4),
 (7.6293945e-05, 5),
 (9.1552734e-05, 6),
 (0.00010681152, 7),
 (0.00012207031, 8),
 (0.00015258789, 9),
 (0.00018310547, 10),
 (0.00021362305, 11),
 (0.00024414062, 12),
 (0.00030517578, 13),
 (0.00036621094, 14),
 (0.0004272461, 15),
 (0.00048828125, 16),
 (0.00061035156, 17),
 (0.0007324219, 18),
 (0.0008544922, 19),
 (0.0009765625, 20),
 (0.0012207031, 21),
 (0.0014648438, 22),
 (0.0017089844, 23),
 (0.001953125, 24),
 (0.0024414062, 25),
 (0.0029296875, 26),
 (0.0034179688, 27),
 (0.00390625, 28),
 (0.0048828125, 29),
 (0.005859375, 30),
 (0.0068359375, 31),
 (0.0078125, 32),
 (0.009765625, 33),
 (0.01171875, 34),
 (0.013671875, 35),
 (0.015625, 36),
 (0.01953125, 37),
 (0.0234375, 38),
 (0.02734375, 39),
 (0.03125, 40),
 (0.0390625, 41),
 (0.046875, 42),
 (0.0546875, 43),
 (0.0625, 44),
 (0.078125, 45),
 (0.09375, 46),
 (0.109375, 47),
 (0.125, 48),
 (0.15625, 49),
 (0.1875, 50),
 (0.21875, 51),
 (0.25, 52),
 (0.3125, 53),
 (0.375, 54),
 (0.4375, 55),
 (0.5, 56),
 (0.625, 57),
 (0.75, 58),
 (0.875, 59),
 (1.0, 60),
 (1.25, 61),
 (1.5, 62),
 (1.75, 63),
 (2.0, 64),
 (2.5, 65),
 (3.0, 66),
 (3.5, 67),
 (4.0, 68),
 (5.0, 69),
 (6.0, 70),
 (7.0, 71),
 (8.0, 72),
 (10.0, 73),
 (12.0, 74),
 (14.0, 75),
 (16.0, 76),
 (20.0, 77),
 (24.0, 78),
 (28.0, 79),
 (32.0, 80),
 (40.0, 81),
 (48.0, 82),
 (56.0, 83),
 (64.0, 84),
 (80.0, 85),
 (96.0, 86),
 (112.0, 87),
 (128.0, 88),
 (160.0, 89),
 (192.0, 90),
 (224.0, 91),
 (256.0, 92),
 (320.0, 93),
 (384.0, 94),
 (448.0, 95),
 (512.0, 96),
 (640.0, 97),
 (768.0, 98),
 (896.0, 99),
 (1024.0, 100),
 (1280.0, 101),
 (1536.0, 102),
 (1792.0, 103),
 (2048.0, 104),
 (2560.0, 105),
 (3072.0, 106),
 (3584.0, 107),
 (4096.0, 108),
 (5120.0, 109),
 (6144.0, 110),
 (7168.0, 111),
 (8192.0, 112),
 (10240.0, 113),
 (12288.0, 114),
 (14336.0, 115),
 (16384.0, 116),
 (20480.0, 117),
 (24576.0, 118),
 (28672.0, 119),
 (32768.0, 120),
 (40960.0, 121),
 (49152.0, 122),
 (57344.0, 123),
 (inf, 124)]

Total running time of the script: (0 minutes 0.030 seconds)

Gallery generated by Sphinx-Gallery