-
Notifications
You must be signed in to change notification settings - Fork 943
Conversation
* `tf.linalg.gramSchmidt` performs Gram-Schmidt orthogonalization on Matrices or arrays of vectors. It will be used to speed up the orthogonal initialization of weights (e.g., in RNNs). * `tf.eye` generates identity matrices. Towards: tensorflow/tfjs#245
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
One nit, one food for thought re. random tests.
src/ops/linalg_ops.ts
Outdated
const ys: Tensor1D[] = []; | ||
for (let i = 0; i < xs.length; ++i) { | ||
ys.push(Tracking.tidy(() => { | ||
let x = (xs as Tensor1D[])[i]; |
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.
xs
was already cast to Tensor1D
in line 62
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.
The linter complains if I remove this explicit casting.
src/ops/linalg_ops_test.ts
Outdated
describeWithFlags('gramSchmidt-tiny', ALL_ENVS, () => { | ||
// TODO(cais): Small things should get tested on ALL_ENVS. | ||
it('2x2, Array of Tensor1D', () => { | ||
const xs: Tensor1D[] = [tf.tensor1d([1, 2]), tf.tensor1d([-1, 5])]; |
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.
This might be a good candidate for a random array as input
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.
Done. Using random vectors and matrics in this test file, wherever it makes sense.
Review status: 0 of 5 files reviewed at latest revision, 2 unresolved discussions. Comments from Reviewable |
Reviewed 3 of 5 files at r1, 2 of 2 files at r3. src/ops/array_ops.ts, line 376 at r3 (raw file):
typo src/ops/linalg_ops.ts, line 71 at r1 (raw file): Previously, caisq (Shanqing Cai) wrote…
Could avoid this by creating a local xs1d instead of overwriting the xs parameter Comments from Reviewable |
* Use as2D() in tf.eye * Define xs1d in gramSchmidt().
Review status: 3 of 5 files reviewed at latest revision, 3 unresolved discussions, some commit checks failed. src/ops/linalg_ops.ts, line 71 at r1 (raw file): Previously, davidsoergel (David Soergel) wrote…
Done. Comments from Reviewable |
Review status: 3 of 5 files reviewed at latest revision, 3 unresolved discussions, all commit checks successful. src/ops/array_ops.ts, line 376 at r3 (raw file): Previously, davidsoergel (David Soergel) wrote…
Done. Comments from Reviewable |
Review status: 3 of 5 files reviewed at latest revision, 3 unresolved discussions, some commit checks failed. src/ops/array_ops.ts, line 381 at r4 (raw file):
align with tf.eye by adding src/ops/linalg_ops.ts, line 46 at r5 (raw file):
what's the tensorflow's equivalent op and can we align that API? Comments from Reviewable |
Review status: 3 of 5 files reviewed at latest revision, 5 unresolved discussions, some commit checks failed. src/ops/linalg_ops.ts, line 35 at r5 (raw file):
Just say: - an array of src/ops/linalg_ops.ts, line 46 at r5 (raw file): Previously, dsmilkov (Daniel Smilkov) wrote…
Talked offline. Resolving src/ops/linalg_ops_test.ts, line 24 at r5 (raw file):
is this TODO outdated? Comments from Reviewable |
Review status: 1 of 5 files reviewed at latest revision, 6 unresolved discussions, some commit checks failed. src/ops/array_ops.ts, line 381 at r4 (raw file): Previously, dsmilkov (Daniel Smilkov) wrote…
Done. src/ops/linalg_ops.ts, line 35 at r5 (raw file): Previously, dsmilkov (Daniel Smilkov) wrote…
Done. src/ops/linalg_ops_test.ts, line 24 at r5 (raw file): Previously, dsmilkov (Daniel Smilkov) wrote…
Yes. Removed. Comments from Reviewable |
tf.linalg.gramSchmidt
performs Gram-Schmidt orthogonalization onMatrices or arrays of vectors. It will be used to speed up
the orthogonal initialization of weights (e.g., in RNNs).
tf.eye
generates identity matrices.Towards: tensorflow/tfjs#245
This change is