-
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
#7376 Allow seeding the Orthogonal Initializer and use QR instead of gramSchmidt #7377
#7376 Allow seeding the Orthogonal Initializer and use QR instead of gramSchmidt #7377
Conversation
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
…d use QR decomposition method instead of gramSchmidt for consistency with the python implementation
0b9f409
to
ae174dc
Compare
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: 0 of 1 approvals obtained (waiting on @cosminc98)
tfjs-layers/src/initializers.ts
line 557 at r1 (raw file):
for (const dim of shape.slice(0, -1)) { numRows *= dim; }
You can use the util.sizeFromShape(shape) method from tfjs-core
Code quote:
let numRows = 1;
for (const dim of shape.slice(0, -1)) {
numRows *= dim;
}
tfjs-layers/src/initializers.ts
line 568 at r1 (raw file):
const maxDim = Math.max(numCols, numRows); const minDim = Math.min(numCols, numRows); const flatShape = [maxDim, minDim];
Prefer removing the intermediate variables:
const flatShape = [Math.max(numCols, numRows), Math.min(numCols, numRows)];
Code quote:
const maxDim = Math.max(numCols, numRows);
const minDim = Math.min(numCols, numRows);
const flatShape = [maxDim, minDim];
… variables in Orthogonal Initializer apply method
3cb4348
to
90e8a36
Compare
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
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.
LGTM
Allow seeding the Orthogonal Initializer and add test. Use QR instead of gramSchmidt for consistency with the python implementation.
To see the logs from the Cloud Build CI, please join either our discussion or announcement mailing list.
This change is