Skip to main content

A tiny symbolic autodiff demo built on Sympy.

Project description

SymGrad4T

一个用 Sympy 做符号表达的极简自动求导/张量广播示例。支持基本张量算子(加减乘除、幂、求和、广播、LaTeX 输出等),附带示例脚本与测试。

运行测试

  • 项目根目录执行:pytest -q
  • 如需只跑库内测试:cd SymGrad && pytest -q

运行示例

  • 示例脚本:SymGrad/run.py
  • 运行命令:python SymGrad/run.py
  • 默认脚本构建一个简单的归一化与乘法组合,并打印 xw 的梯度(LaTeX 形式)。

已支持的 OP

  • 加减乘除:Add / Sub / Mul / Div(支持广播与标量/符号)
  • 幂:Power(支持标量或张量指数,广播)
  • 平方根:Sqrt
  • 维度求和:Sum(dim, keepdim=False)(支持负索引与 keepdim)
  • 广播:Broadcast / Tensor.broadcast_to
  • LaTeX 输出:Tensor.latex_expr() / Tensor.latex_grad()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

symgrad4t-0.1.0.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

symgrad4t-0.1.0-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file symgrad4t-0.1.0.tar.gz.

File metadata

  • Download URL: symgrad4t-0.1.0.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.9

File hashes

Hashes for symgrad4t-0.1.0.tar.gz
Algorithm Hash digest
SHA256 543a8d174f14cf204d46bbb3727c97097be26e4b50adc4793f935fd737055e8b
MD5 69db3fc7878dcefa3977b26c2b2a9f31
BLAKE2b-256 bd3d5f3718cffc782d555aa9b803cc463c2694f2ff43a4943544b6a7ef1e09ed

See more details on using hashes here.

File details

Details for the file symgrad4t-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: symgrad4t-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.9

File hashes

Hashes for symgrad4t-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 47320beb6f9ddb7d406e7310107531a1c542b4e2231974b951b1d277c70fdf00
MD5 d798fc63cb07b8820a356e378357d283
BLAKE2b-256 1e5a4296fc961c295e260cd8062a88f42a44723d249120d0bb744acbb70d6cf8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page