Skip to content
This repository has been archived by the owner on Jul 1, 2023. It is now read-only.

Add linear algebra operations and their derivatives #562

Open
10 of 15 tasks
dan-zheng opened this issue Nov 20, 2019 · 10 comments
Open
10 of 15 tasks

Add linear algebra operations and their derivatives #562

dan-zheng opened this issue Nov 20, 2019 · 10 comments

Comments

@dan-zheng
Copy link
Member

dan-zheng commented Nov 20, 2019

Swift for TensorFlow should provide standard linear algebra operations from tf.linalg/np.linalg:

Some of these operations are already accessible via TensorFlow bindings, e.g. _Raw.cholesky, _Raw.choleskyGrad.

Reference TensorFlow derivative implementations: https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/ops/linalg_grad.py


Mirror of TF-980.

If anyone requests support for specific operations, please comment and we add to the checklist!

@awav
Copy link
Contributor

awav commented Nov 20, 2019

Hello @dan-zheng, this is not a full list of operations, but it would be good to start with this (all of them implicitly should work as batched versions as well):

  • Norm
  • Trace
  • Cholesky
  • Triangular Solve
  • Cholesky Solve
  • Diag (make a [batch] tensor from [batch] diagonal)
  • Diag Part (extract [batch] diagonal)
  • Einsum
  • Eye
  • Logdet
  • Eigh

@awav
Copy link
Contributor

awav commented Nov 22, 2019

@dan-zheng , how can I add a new binding here? It is an auto-generated file and I don't see how it was generated.

@Shashi456
Copy link
Contributor

@awav you can't add new bindings in that file, You can check where how its generated here.

@awav
Copy link
Contributor

awav commented Nov 22, 2019

[EDITED] that's my bad, "TriangularSolve" is in the RawOpsGenerated.swift file, as well as many other linalg ops.

@Shashi456 , yeah, I've checked it. But, it is not clear why for e.g. "TriangularSolve" is not reflected in the RawOpsGenerated.swift file, but "TriangularSolve" is in the ops.pbtxt. Does S4TF uses different protobuf file?

@dan-zheng
Copy link
Member Author

@Shashi456 , yeah, I've checked it. But, it is not clear why for e.g. "TriangularSolve" is not reflected in the RawOpsGenerated.swift file, but "TriangularSolve" is in the ops.pbtxt. Does S4TF uses different protobuf file?

Swift for TensorFlow uses the same ops.pbtxt - here's the script that generates op bindings.

TensorFlow.Raw and ops.pbtxt are consistent, both define matrixTriangularSolve and batchMatrixTriangularSolve:

image

@Shashi456
Copy link
Contributor

@awav are you working on supporting these ops? could i ask what ops you are working on currently?

@awav
Copy link
Contributor

awav commented Dec 6, 2019

@Shashi456, solvers and trace for now

@dan-zheng, you can mark diag and diag_part as finished. They were implemented in #571

@awav
Copy link
Contributor

awav commented Dec 13, 2019

@Shashi456, @dan-zheng hello guys, sorry for the delay with PRs for solvers and other promised ops. I'm at NeurIPS and don't have much time to finish the work. Thanks!

@awav
Copy link
Contributor

awav commented Dec 20, 2019

@dan-zheng, trace can be marked as done now.

@pedronahum
Copy link

Hi,
If I can add to the wishlist, the following matrix operations could be useful:

  • QR eigen decomposition with explicit shift (Wilkinson shif)
  • the Schur decomposition

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants