tensorflow / tfjs

A WebGL accelerated JavaScript library for training and deploying ML models.
https://js.tensorflow.org
Apache License 2.0
18.36k stars 1.92k forks source link

tf.linalg.inv() #8173

Open N1k0l1n opened 7 months ago

N1k0l1n commented 7 months ago

Please make sure that this is a feature request. As per our GitHub Policy, we only address code/doc bugs, performance issues, feature requests and build/installation issues on GitHub. tag:feature_template

As a new user of TensorFlow.js, I've been exploring its capabilities for machine learning tasks. While following lectures and tutorials, I encountered a need to compute the inverse of a matrix using TensorFlow.js. Here is an example :

const x = tf.tensor2d([[ 4, 2], [-5, -3]]); //Does not exist in tensorflow js let y = tf.linalg.inv(x); y.print()

However, I couldn't find a built-in function for this purpose. Therefore, I would like to request the addition of a new function, tf.linalg.inv(), to compute the inverse of a matrix in TensorFlow.js. (Or any work around) Any Help is much appreciated. Thank you for your time and pattience

System information

Describe the feature and the current behavior/state.

Will this change the current api? How?

Who will benefit with this feature?

Any Other info.

gaikwadrahul8 commented 7 months ago

Hi, @N1k0l1

Thank you for suggesting the addition of tf.linalg.inv() to TensorFlow.js! We appreciate your feedback and interest in expanding the library's capabilities.

While we recognize the potential benefits of this feature, it's important to note that it's already available within the core TensorFlow codebase. You can access it using Python please refer tf.linalg.inv

We understand that having this functionality directly in TensorFlow.js would be convenient for browser-based or JavaScript-focused projects. However, implementing it in TensorFlow.js involves technical considerations and alignment with our current development priorities.

If someone or you're interested in seeing this feature implemented directly in TensorFlow.js, we welcome contributions from you and the community please refer How to Contribute and How to Contribute a New op to TF.js Repository

Thank you for your cooperation and patience.