No project description provided
Project description
ml_dtypes
This is not an officially supported Google product.
ml_dtypes
is a stand-alone implementation of several NumPy dtype extensions used in machine learning libraries, including:
bfloat16
: an alternative to the standardfloat16
formatfloat8_*
: several experimental 8-bit floating point representations including:float8_e4m3b11
float8_e4m3fn
float8_e5m2
Installation
The ml_dtypes
package is tested with Python versions 3.8-3.11, and can be installed
with the following command:
pip install ml_dtypes
To test your installation, you can run the following:
pip install absl-py pytest
pytest --pyargs ml_dtypes
To build from source, clone the repository and run:
git submodule init
git submodule update
pip install .
Example Usage
>>> from ml_dtypes import bfloat16
>>> import numpy as np
>>> np.zeros(4, dtype=bfloat16)
array([0, 0, 0, 0], dtype=bfloat16)
Importing ml_dtypes
also registers the data types with numpy, so that they may
be referred to by their string name:
>>> np.dtype('bfloat16')
dtype(bfloat16)
>>> np.dtype('float8_e5m2')
dtype(float8_e5m2)
License
The ml_dtypes
source code is licensed under the Apache 2.0 license
(see LICENSE). Pre-compiled wheels are built with the
EIGEN project, which is released under the
MPL 2.0 license (see LICENSE.eigen).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for ml_dtypes-0.0.3-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 94c7ec5c9378d754ed2db8896c0007d3981c61850397cdaa06fc45f6149ad565 |
|
MD5 | b92d0e0a3e44a90b9e9dde40b533f317 |
|
BLAKE2b-256 | 413213337c6257347eddda26c211e73bc08c176064433fa75d7c36776892481b |
Hashes for ml_dtypes-0.0.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 02d69d0e20693e2b98a98265ae805f7b9eada978e22a23fbde6d91ebe784889f |
|
MD5 | e8cf7a3881784e54840dc5370e738e66 |
|
BLAKE2b-256 | cafb3c8982077699318469f58eb48dff12f10de1c14904e1c955dead33fdd6fd |
Hashes for ml_dtypes-0.0.3-cp311-cp311-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f889c9cdb33bffc9c2a18cb2a0d677064d86bb2e6984201ed7ff47cb0612f033 |
|
MD5 | 71e0d23aeb06ce85278b146b34616071 |
|
BLAKE2b-256 | cf195a04986473c19ad2559061b7f98de5190465954dbd57ca854594934872ca |
Hashes for ml_dtypes-0.0.3-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 915328dc850395ff2ea05f6a0257bdff5eff3914aad2522541632c4f5cf259a1 |
|
MD5 | 921f30d20532c2367a2ca7f59a962dde |
|
BLAKE2b-256 | a81b80f63070d3c49affc5265fca3db91605b2ff091a8d574dd5a0244d9fd3f3 |
Hashes for ml_dtypes-0.0.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eabaf3690158ba769d3050f5acdd7766fc9c91bc5e146b695cdb489c7bae58d6 |
|
MD5 | 27195745c3499c3bdb0f85a3c361725e |
|
BLAKE2b-256 | 79b0a108ed42b70d2ebdf86fb884cc10ef20959a58d00c6d28aeae1f20ea95e1 |
Hashes for ml_dtypes-0.0.3-cp310-cp310-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cf49715c9b8a8baf878c53bbe20aef30531f9f8bd85c679a2b1eb3f29302ce3d |
|
MD5 | 13f9ff7f8e7fb893c40ad7b2e8068a11 |
|
BLAKE2b-256 | 81571d1f4b3d0d10ba1b41b432ccccfb94af7276f5bf0e77f0a8d5d9a22cc7dd |
Hashes for ml_dtypes-0.0.3-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | acc02d67ae09bbad1a49766d58661875f6c28adb130f75737607f7dca0d32136 |
|
MD5 | 8464c85ffa7ea0489e5953043ffb57f8 |
|
BLAKE2b-256 | fbb3a01d3c19aec9c2e63fbd394e2d6008d9f91017c0b433e2d22a6f4d9a75ff |
Hashes for ml_dtypes-0.0.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3b7f7ec7dbef758391eae98f7682df4bc550db184b83805a1d3fa3c06ee65909 |
|
MD5 | ab30d6865db96ae734132a5e49886548 |
|
BLAKE2b-256 | 4b074930066316e07498880a8c1785bc3ad11ed1d113d39a777be4e88866c88c |
Hashes for ml_dtypes-0.0.3-cp39-cp39-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7a2720452e4595cee86b7c900bb1b31707c663222b5f0bf68bb9d511a86cf65b |
|
MD5 | 4e4eeb9336199fba0ff2aee8c65efc74 |
|
BLAKE2b-256 | 9894e33b044f11714b12cc9697aac870c301ad9dd50304c2a60a92578b11245f |
Hashes for ml_dtypes-0.0.3-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a3dc05e59d3b7123c269f646146cd22e9ab62f71c696572e26bab065beba7d9f |
|
MD5 | e4a15d6c70974c2c7110d08328843504 |
|
BLAKE2b-256 | 4c96e1a6ec7a15eae66ebe3d5c997aba8799703fdcd1e967acd0e3a6a3e5d4de |
Hashes for ml_dtypes-0.0.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 644246afcefdf7a77fd27018b2441d35bd566d6e53f3c4f7f029c1598361142c |
|
MD5 | c106ffa48dfb97e5c4b5da531148fbfe |
|
BLAKE2b-256 | 1b738ccaa133fcabc5178bdfd0f2d43020aa262f6dbc1e51220aa110039a647f |
Hashes for ml_dtypes-0.0.3-cp38-cp38-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1236ac47bb58e4a54123ac529c578dfe23a5882a515329fddfb82345b131f102 |
|
MD5 | f867a8d7cd0bcfab3c6b9a9b31e90065 |
|
BLAKE2b-256 | 5e2b2ebd44d13aaa0535547a4aac06f6f84e8b6a962a8f7876b31da67736d854 |