Skip to content

Conversation

xadupre
Copy link
Contributor

@xadupre xadupre commented Jun 10, 2024

Description

Supports bfloat16 binary, unary operations if ml_dtypes is installed. Partially answer #6151.

Motivation and Context

numpy does not support bfloat16 natively but pytorch or tensorflow does. The reference implementation should support that as well.

…ntation

Signed-off-by: Xavier Dupre <xadupre@microsoft.com>
@xadupre xadupre requested review from a team as code owners June 10, 2024 13:16
xadupre added 3 commits June 10, 2024 16:53
Signed-off-by: Xavier Dupre <xadupre@microsoft.com>
Signed-off-by: Xavier Dupre <xadupre@microsoft.com>
Signed-off-by: Xavier Dupre <xadupre@microsoft.com>
Copy link

codecov bot commented Jun 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 57.24%. Comparing base (83194ed) to head (9b297c0).
Report is 51 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6166      +/-   ##
==========================================
+ Coverage   56.95%   57.24%   +0.28%     
==========================================
  Files         506      506              
  Lines       30467    31036     +569     
  Branches     4592     4614      +22     
==========================================
+ Hits        17353    17766     +413     
- Misses      12285    12446     +161     
+ Partials      829      824       -5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: Xavier Dupre <xadupre@microsoft.com>
xadupre added 3 commits June 10, 2024 17:28
Signed-off-by: Xavier Dupre <xadupre@microsoft.com>
Signed-off-by: Xavier Dupre <xadupre@microsoft.com>
Signed-off-by: Xavier Dupre <xadupre@microsoft.com>
@gramalingam
Copy link
Contributor

What will dtype look like in the numpy array? Specifically: I wonder if np_dtype_to_tensor_dtype will work correctly, or if it needs to be extended?

What about [TENSOR_TYPE_MAP] (

TENSOR_TYPE_MAP = {
) ?

Related bug in onnxscript: microsoft/onnxscript#1543

@xadupre
Copy link
Contributor Author

xadupre commented Jun 11, 2024

Let me create another PR for this one. My change only use mk_dtypes to support binary operations but it does not change the custom dtype used to carry type information in numpy. We can do that as well but we need to decide first if we want to add ml_dtypes as a mandatory dependency.

xadupre and others added 5 commits June 12, 2024 12:56
Signed-off-by: Xavier Dupre <xadupre@microsoft.com>
Signed-off-by: Xavier Dupre <xadupre@microsoft.com>
Signed-off-by: Xavier Dupre <xadupre@microsoft.com>
Signed-off-by: Xavier Dupre <xadupre@microsoft.com>
@xadupre xadupre enabled auto-merge June 13, 2024 08:21
@justinchuby justinchuby disabled auto-merge June 13, 2024 15:20
@justinchuby justinchuby self-assigned this Jun 13, 2024
xadupre and others added 2 commits June 13, 2024 17:21
Co-authored-by: Justin Chu <justinchuby@users.noreply.github.com>
Signed-off-by: Xavier Dupré <xadupre@users.noreply.github.com>
Co-authored-by: Justin Chu <justinchuby@users.noreply.github.com>
Signed-off-by: Xavier Dupré <xadupre@users.noreply.github.com>
Co-authored-by: Justin Chu <justinchuby@users.noreply.github.com>
Signed-off-by: Xavier Dupré <xadupre@users.noreply.github.com>
Signed-off-by: Xavier Dupre <xadupre@microsoft.com>
xadupre added 2 commits June 13, 2024 17:45
Signed-off-by: Xavier Dupre <xadupre@microsoft.com>
Signed-off-by: Xavier Dupre <xadupre@microsoft.com>
@xadupre xadupre added this pull request to the merge queue Jun 21, 2024
Merged via the queue into onnx:main with commit 0e808c5 Jun 21, 2024
@xadupre xadupre deleted the bfl16 branch June 21, 2024 09:35
@xadupre xadupre self-assigned this Jun 21, 2024
andife pushed a commit to andife/onnx that referenced this pull request Jul 20, 2024
…ntation (onnx#6166)

### Description
Supports bfloat16 binary, unary operations if ml_dtypes is installed.
Partially answer onnx#6151.

### Motivation and Context
numpy does not support bfloat16 natively but pytorch or tensorflow does.
The reference implementation should support that as well.

---------

Signed-off-by: Xavier Dupre <xadupre@microsoft.com>
Signed-off-by: Xavier Dupré <xadupre@users.noreply.github.com>
Co-authored-by: Justin Chu <justinchuby@users.noreply.github.com>
Signed-off-by: Andreas Fehlner <fehlner@arcor.de>
linshokaku pushed a commit to linshokaku/onnx that referenced this pull request Oct 2, 2024
…ntation (onnx#6166)

### Description
Supports bfloat16 binary, unary operations if ml_dtypes is installed.
Partially answer onnx#6151.

### Motivation and Context
numpy does not support bfloat16 natively but pytorch or tensorflow does.
The reference implementation should support that as well.

---------

Signed-off-by: Xavier Dupre <xadupre@microsoft.com>
Signed-off-by: Xavier Dupré <xadupre@users.noreply.github.com>
Co-authored-by: Justin Chu <justinchuby@users.noreply.github.com>
Signed-off-by: Linsho Kaku <linsho@preferred.jp>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants