Skip to main content

No project description provided

Project description

ml_dtypes

Unittests Wheel Build PyPI version

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 standard float16 format
  • float8_*: several experimental 8-bit floating point representations including:
    • float8_e4m3b11
    • float8_e4m3fn
    • float8_e5m2

Installation

We will soon release pre-built wheels for this package at http://pypi.org/project/ml-dtypes, so this package can be easily pip installed.

To build locally, 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)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ml_dtypes-0.0.2rc5.tar.gz (683.1 kB view hashes)

Uploaded Source

Built Distributions

ml_dtypes-0.0.2rc5-cp311-cp311-win_amd64.whl (135.3 kB view hashes)

Uploaded CPython 3.11 Windows x86-64

ml_dtypes-0.0.2rc5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (230.9 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

ml_dtypes-0.0.2rc5-cp311-cp311-macosx_10_9_universal2.whl (311.9 kB view hashes)

Uploaded CPython 3.11 macOS 10.9+ universal2 (ARM64, x86-64)

ml_dtypes-0.0.2rc5-cp310-cp310-win_amd64.whl (135.4 kB view hashes)

Uploaded CPython 3.10 Windows x86-64

ml_dtypes-0.0.2rc5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (230.9 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

ml_dtypes-0.0.2rc5-cp310-cp310-macosx_10_9_universal2.whl (311.9 kB view hashes)

Uploaded CPython 3.10 macOS 10.9+ universal2 (ARM64, x86-64)

ml_dtypes-0.0.2rc5-cp39-cp39-win_amd64.whl (135.3 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

ml_dtypes-0.0.2rc5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (231.0 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

ml_dtypes-0.0.2rc5-cp39-cp39-macosx_10_9_universal2.whl (312.2 kB view hashes)

Uploaded CPython 3.9 macOS 10.9+ universal2 (ARM64, x86-64)

ml_dtypes-0.0.2rc5-cp38-cp38-win_amd64.whl (134.8 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

ml_dtypes-0.0.2rc5-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (231.0 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

ml_dtypes-0.0.2rc5-cp38-cp38-macosx_10_9_universal2.whl (311.8 kB view hashes)

Uploaded CPython 3.8 macOS 10.9+ universal2 (ARM64, x86-64)

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page