Skip to content
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

Add 2 patterns to fuse nodes into SoftmaxCrossEntropyLoss #1782

Closed
wants to merge 12 commits into from

Conversation

xadupre
Copy link
Member

@xadupre xadupre commented Aug 6, 2024

Fixes infinite outputs when this operator is decomposed.

Copy link

codecov bot commented Aug 6, 2024

Codecov Report

Attention: Patch coverage is 83.63636% with 18 lines in your changes missing coverage. Please review.

Project coverage is 75.11%. Comparing base (87aee66) to head (8d036da).
Report is 39 commits behind head on main.

Files with missing lines Patch % Lines
onnxscript/rewriter/onnx_fusion_rule_sets_test.py 84.74% 4 Missing and 5 partials ⚠️
onnxscript/rewriter/onnx_fusion_rule_sets.py 83.67% 4 Missing and 4 partials ⚠️
onnxscript/rewriter/pattern.py 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1782      +/-   ##
==========================================
+ Coverage   75.07%   75.11%   +0.04%     
==========================================
  Files         245      247       +2     
  Lines       26555    26663     +108     
  Branches     4873     4898      +25     
==========================================
+ Hits        19936    20028      +92     
- Misses       5685     5692       +7     
- Partials      934      943       +9     

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

Comment on lines +50 to +58
# import onnxruntime does not because of the subfolder named onnxruntime
import os
import sys

sys_path = sys.path
sys.path = [os.path.join(onnx.__file__, "..", "..")] + [
p for p in sys_path if "onnxruntime" in p
]
import onnxruntime
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The right fix is to rename onnxruntime subfolder.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #1786.

Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lintrunner found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

@justinchuby justinchuby self-assigned this Aug 7, 2024
@justinchuby
Copy link
Collaborator

The pattern should now become

{LogSoftmax -> NegativeLogLikelihoodLoss}

@@ -0,0 +1,108 @@
# Copyright (c) Microsoft Corporation.

Check warning

Code scanning / lintrunner

RUFF/format Warning

Run lintrunner -a to apply this patch.
@@ -0,0 +1,108 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
from __future__ import annotations

Check warning

Code scanning / lintrunner

RUFF/I001 Warning

Import block is un-sorted or un-formatted.
See https://docs.astral.sh/ruff/rules/unsorted-imports
@gramalingam
Copy link
Collaborator

I believe this is outdated and can be closed?

@xadupre xadupre closed this Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

4 participants