TensorGrad Documentation

TensorGrad is a tensor & deep learning framework that combines PyTorch's computationa power with symbolic manipulation capabilities. It provides powerful visualization tools for tensor networks and automatic differentiation.

Key Features

Installation

pip install tensorgrad

Note: For visualizations, additional LaTeX packages are required:

apt-get install texlive-luatex
 apt-get install texlive-latex-extra
 apt-get install texlive-fonts-extra
 apt-get install poppler-utils

Quick Example

from tensorgrad import Variable
 import tensorgrad.functions as F
 from sympy import symbols

 # Create symbolic dimensions
 b, x, y = symbols("b x y")

 # Define variables
 X = Variable("X", b, x)
 Y = Variable("Y", b, y)
 W = Variable("W", x, y)

 # Create computation
 XWmY = X @ W - Y
 l2 = XWmY @ XWmY

 # Compute gradient
 grad = l2.grad(W)

 # The result can be:
 # - Evaluated with actual tensors
 # - Visualized as a tensor diagram
 # - Converted to PyTorch code

Learn More