-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
[webgl] Fix uninitialized zeros tensors, fix dtype upcasting. #4064
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: complete! 1 of 1 approvals obtained (waiting on @annxingyuan, @pyu10055, and @tafsiri)
tfjs-backend-webgl/src/kernels/Cast.ts, line 76 at r1 (raw file):
if (dtype === 'bool') { const zerosTensorInfo = backend.makeTensorInfo( [], 'bool', util.getTypedArrayFromDType('bool', 1));
I think typed array allow zero length, why the length needs to be set to 1 here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 3 of 3 files at r1.
Reviewable status: complete! 1 of 1 approvals obtained (waiting on @annxingyuan, @pyu10055, and @tafsiri)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing the nightly build!
Reviewable status: complete! 1 of 1 approvals obtained (waiting on @annxingyuan, @pyu10055, and @tafsiri)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: complete! 1 of 1 approvals obtained (waiting on @pyu10055 and @tafsiri)
tfjs-backend-webgl/src/kernels/Cast.ts, line 76 at r1 (raw file):
Previously, pyu10055 (Ping Yu) wrote…
I think typed array allow zero length, why the length needs to be set to 1 here?
We need to actually upload the value 0
to the GPU so that we can check whether the input equals 0 as part of casting to bool. The reason this only fails in nightly is because for PR's our threshold for uploading values as textures as opposed to uniforms is 0 (so everything is uploaded as a texture). If we print a zero length typed array to a texture (or even if we print null to a texture), it will be sampled as 0, so tests pass. However there is a difference between uploading 0
as a uniform, and uploading an empty typed array as a uniform.
The test of concat a large number of tensors is still timing out in the latest nightly build:
|
This fixes the nightly build error.
To see the logs from the Cloud Build CI, please join either our discussion or announcement mailing list.
This change is