sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.3k stars 447 forks source link

sage.tensor.modules: Add backends using TensorFlow Core, PyTorch, SymPy #30096

Open mkoeppe opened 4 years ago

mkoeppe commented 4 years ago

Tensors from sage.tensor are stored as sage.tensor.modules.Components, which is a dictionary with index tuples as keys.

We propose to create additional backends for numerical coordinate rings:

They provide efficient storage and GPU-accelerated computations for numerical tensors.

For SymPy, see #31946

CC: @egourgoulhon

Component: linear algebra

Issue created by migration from https://trac.sagemath.org/ticket/30096

mkoeppe commented 3 years ago
comment:2

Setting new milestone based on a cursory review of ticket status, priority, and last modification date.

mkoeppe commented 3 years ago

Description changed:

--- 
+++ 
@@ -1,9 +1,10 @@
 Tensors from `sage.tensor` are stored as `sage.tensor.modules.Components`, which is a dictionary with index tuples as keys.

-We propose to create additional backends.
+We propose to create additional backends for numerical coordinate rings:
 - https://www.tensorflow.org/guide/tensor
 - https://pytorch.org/docs/stable/tensors.html

-They provide efficient storage and GPU-accelerated computations.
+They provide efficient storage and GPU-accelerated computations for numerical tensors.

+For SymPy, see #31946
hyperactivecoder commented 5 months ago

@mkoeppe, can you please let us know more about this? Do we just have to implement all the function in Component class in Pytorch / Tensorflow? What i am understanding is we have to impliment symbolic expressions in tensors, am i mistaken?

mkoeppe commented 5 months ago

The tensors in Sage can be defined with different element types (this is what is called a "base ring" in Sage).

When talking about using Pytorch or Tensorflow as the backend, the most natural thing to consider is the element type being a floating-point number of some precision / format.

When talking about SymPy as the backend, the most natural thing to consider is symbolic expressions.