-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support float16 datatype #410
Comments
Thanks for bringing this up. I'm currently undecided on adding these types to the standard (vs adding them via an extension). My main concerns to adding more datatypes to the ndarray standard are:
@perrygreenfield or @eslavich do either of you have some input on what motivated the current datatypes in ndarray? The current datatypes:
do appear to be a relatively close match to the array-api standard:https://data-apis.org/array-api/latest/API_specification/data_types.html (except for bool8 in asdf-standard vs bool in array-api and the inclusion of ascii and ucs4 datatypes in asdf-standard ).
I haven't looked into what would be required to "extend" the ndarray schema with an updated datatype (to provide a schema for an extension that could implement |
I understand your concerns. Let me make an argument from a different point of view: (1) The array api standard is a standard for Python. I am not really using Python; I'm usually using either C++ or Julia. Here is a list of datatypes supported by C++. That's a relatively small number of types, and these types will come up naturally in many circumstances. Julia supports float16, float32, and float64. (2) It isn't really important to me whether this is part of the standard or part of an extension. However, (3) Independent of the above it would be very convenient if the content of ASDF files were accessible without loading an extension for datatypes. The HDF5 standard defines a way to define floating-point types, and contains generic code to convert between any kind of floating-point numbers. This allows reading any HDF5 file into any floating-point format. For example, reading |
To keep this conversation going (which I think is great!) I'm going to comment on a few (but not all) of the points raised. re 1) float16 would be relatively easy for the python asdf library to support (as it's supported by numpy). complex32 is more difficult as it's not supported by numpy. asdf heavily relies on numpy for array handling and may need to define a new dtype and/or change how re 2) Is there a command(s) in re 3) You definitely have me curious to look at the HDF5 standard and implementations to see how that's handled. Since ASDF blocks are just a collection of bytes it should be possible to make an extension that reads these bytes in and converts them to any other format. The python library does something like this for arrays where the block is read as a sequence of bytes and then converted to the dtype from the tree. Internally this is using the same extension API. The asdf-zarr extension also accesses the ASDF block data and converts it to types supported by zarr. |
In light of this issue, would you also consider again adding support for |
@eschnett I just merged #411 adding I am hoping to make a new |
I want to store
float16
types in ndarrays. Would it be possible to extendscalar-datatype
to allow forfloat16
andcomplex32
types?I am specifically looking for the official
float16
type (as available in many compilers and in CUDA) and not forbfloat16
.The text was updated successfully, but these errors were encountered: