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

fixed prelu fusing code that pre-maturely update the constant for multiply node #6876

Merged
merged 2 commits into from
Sep 29, 2022

Conversation

pyu10055
Copy link
Collaborator

@pyu10055 pyu10055 commented Sep 29, 2022

fixed this issue
Our Prelu fusing logic prematurely update the constant value for multiply node when the node graph partially match the prelu logic.
To see the logs from the Cloud Build CI, please join either our discussion or announcement mailing list.


This change is Reviewable

Copy link
Member

@mattsoulanille mattsoulanille left a comment

Choose a reason for hiding this comment

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

LGTM!

@pyu10055 pyu10055 merged commit 4e122a3 into master Sep 29, 2022
@pyu10055 pyu10055 deleted the prelu-fuse-bug branch September 29, 2022 16:42
dydavidkim added a commit to CodeSmithDSMLProjects/tfjs that referenced this pull request Sep 29, 2022
* Customize setTimeout (tensorflow#6694)

If the setTimeout nesting level is greater than 5 and timeout is less
than 4ms, timeout will be clamped to 4ms, which hurts the perf. A custom
setTimeout is provided to mitigate the perf impact.

BUG: tensorflow#6687
Co-authored-by: Na Li <[email protected]>

* Upgrade windows BrowserStack chrome to 104 (tensorflow#6866)

* webgpu: Disable importExternalTexture (tensorflow#6868)

WebGPU Working Group recently found some problem with
importExtenalTexture in spec, so we have to disable it temporarily.

* Refactored Resizing Layer Unit Tests (#38)

* Rescaling Preprocessing Layer
Co-authored-by:
David Kim (@koyykdy) <[email protected]>
Brian Zheng (@Brianzheng123) <[email protected]>

* PR issues resolved

* linting and PR issues resolved
Co-authored-by: Adam Lang (@AdamLang96) <[email protected]>
Co-authored-by: (@Brianzheng123) <[email protected]>

* initial implementation of image preprocessing: resizing layer, and associated unit tests. Comments and refactoring for image scaling layer

* refactoring in computeOutputShape for image resizing layer

* Unit tests for image resizing preprocessing layer expanded and refactored

* refactored unit tests for resizing layer

* Preprocessing-Resizing layer unit test expansion and refactoring.
Co-authored-by: Adam Lang <@AdamLang96> ([email protected])

* cleaning up commit diffs

* cleaning up commit diffs

* PR commit suggestions accepted - code refactored to reflect changes

* resizing layer unit test refactoring

Co-authored-by: AdamLang96 <[email protected]>

* Linting issue resolved: unused import statement culled (#39)

* Rescaling Preprocessing Layer
Co-authored-by:
David Kim (@koyykdy) <[email protected]>
Brian Zheng (@Brianzheng123) <[email protected]>

* PR issues resolved

* linting and PR issues resolved
Co-authored-by: Adam Lang (@AdamLang96) <[email protected]>
Co-authored-by: (@Brianzheng123) <[email protected]>

* initial implementation of image preprocessing: resizing layer, and associated unit tests. Comments and refactoring for image scaling layer

* refactoring in computeOutputShape for image resizing layer

* Unit tests for image resizing preprocessing layer expanded and refactored

* refactored unit tests for resizing layer

* Preprocessing-Resizing layer unit test expansion and refactoring.
Co-authored-by: Adam Lang <@AdamLang96> ([email protected])

* cleaning up commit diffs

* cleaning up commit diffs

* PR commit suggestions accepted - code refactored to reflect changes

* resizing layer unit test refactoring

* linting issues resolved: unusued import statement culled

Co-authored-by: AdamLang96 <[email protected]>

* Update jasmine_util.ts (tensorflow#6872)

FIX

* webgl: Fix NaN issue (tensorflow#6828)

Fix tensorflow#6822

Problem
1: On some GPUs, even if a and b are both non-NaN, the value of isNaN in vec4 isNaN = min(vec4(isnan(a)) + vec4(isnan(b)), vec4(1.0)); are still larger than 0., which misleads all values become NAN.
2: After resolving NAN issue, the result is still incorrect. It seems that the isnan_custom is not well supported on the problem GPU. After switching back to builtin isnan, everything works well.

Solution:
Use the bool type bvec4 instead of float type vec4 to calculate isNaN to avoid the the float precision issue when comparing with zero.
Meanwhile, add an env flag WEBGL2_ISNAN_CUSTOM to allow user to specify which isnan to use.

* Upgrade nodejs to 18.7.0 (tensorflow#6863)

* Upgrade nodejs to 18.7.0

* Fix hash table test string not passed as base64

* fixed prelu fusing code that pre-maturely neg the const on multiply (tensorflow#6876)

Co-authored-by: RajeshT <[email protected]>

* Update tfjs-layers/src/layers/preprocessing/image_resizing.ts

Co-authored-by: Matthew Soulanille <[email protected]>

Co-authored-by: Yang Gu <[email protected]>
Co-authored-by: Na Li <[email protected]>
Co-authored-by: Matthew Soulanille <[email protected]>
Co-authored-by: AdamLang96 <[email protected]>
Co-authored-by: Linchenn <[email protected]>
Co-authored-by: Jiajia Qin <[email protected]>
Co-authored-by: Ping Yu <[email protected]>
Co-authored-by: RajeshT <[email protected]>
Co-authored-by: Matthew Soulanille <[email protected]>

Co-authored-by: Yang Gu <[email protected]>
Co-authored-by: Na Li <[email protected]>
Co-authored-by: Matthew Soulanille <[email protected]>
Co-authored-by: AdamLang96 <[email protected]>
Co-authored-by: Linchenn <[email protected]>
Co-authored-by: Jiajia Qin <[email protected]>
Co-authored-by: Ping Yu <[email protected]>
Co-authored-by: RajeshT <[email protected]>
Co-authored-by: Matthew Soulanille <[email protected]>
dydavidkim added a commit to CodeSmithDSMLProjects/tfjs that referenced this pull request Sep 29, 2022
* Update jasmine_util.ts (tensorflow#6872)

FIX

* webgl: Fix NaN issue (tensorflow#6828)

Fix tensorflow#6822

Problem
1: On some GPUs, even if a and b are both non-NaN, the value of isNaN in vec4 isNaN = min(vec4(isnan(a)) + vec4(isnan(b)), vec4(1.0)); are still larger than 0., which misleads all values become NAN.
2: After resolving NAN issue, the result is still incorrect. It seems that the isnan_custom is not well supported on the problem GPU. After switching back to builtin isnan, everything works well.

Solution:
Use the bool type bvec4 instead of float type vec4 to calculate isNaN to avoid the the float precision issue when comparing with zero.
Meanwhile, add an env flag WEBGL2_ISNAN_CUSTOM to allow user to specify which isnan to use.

* Upgrade nodejs to 18.7.0 (tensorflow#6863)

* Upgrade nodejs to 18.7.0

* Fix hash table test string not passed as base64

* fixed prelu fusing code that pre-maturely neg the const on multiply (tensorflow#6876)

Co-authored-by: RajeshT <[email protected]>

Co-authored-by: Linchenn <[email protected]>
Co-authored-by: Jiajia Qin <[email protected]>
Co-authored-by: Matthew Soulanille <[email protected]>
Co-authored-by: Ping Yu <[email protected]>
Co-authored-by: RajeshT <[email protected]>
dydavidkim added a commit to CodeSmithDSMLProjects/tfjs that referenced this pull request Sep 29, 2022
* Update jasmine_util.ts (tensorflow#6872)

FIX

* webgl: Fix NaN issue (tensorflow#6828)

Fix tensorflow#6822

Problem
1: On some GPUs, even if a and b are both non-NaN, the value of isNaN in vec4 isNaN = min(vec4(isnan(a)) + vec4(isnan(b)), vec4(1.0)); are still larger than 0., which misleads all values become NAN.
2: After resolving NAN issue, the result is still incorrect. It seems that the isnan_custom is not well supported on the problem GPU. After switching back to builtin isnan, everything works well.

Solution:
Use the bool type bvec4 instead of float type vec4 to calculate isNaN to avoid the the float precision issue when comparing with zero.
Meanwhile, add an env flag WEBGL2_ISNAN_CUSTOM to allow user to specify which isnan to use.

* Upgrade nodejs to 18.7.0 (tensorflow#6863)

* Upgrade nodejs to 18.7.0

* Fix hash table test string not passed as base64

* fixed prelu fusing code that pre-maturely neg the const on multiply (tensorflow#6876)

Co-authored-by: RajeshT <[email protected]>

Co-authored-by: Linchenn <[email protected]>
Co-authored-by: Jiajia Qin <[email protected]>
Co-authored-by: Matthew Soulanille <[email protected]>
Co-authored-by: Ping Yu <[email protected]>
Co-authored-by: RajeshT <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Blank Output After Tensorflow Saved Model to Graph Model Conversion (works on TFLite model)
4 participants