Skip to main content

timod

TaichIMODule, a tiny pytorch module wrapper for differentiable Taichi kernels.

Install

pip install timod

Usage

Given a taichi kernel my_kernel with input and output tensors typed ti.types.ndarray():

from timod import TaichiKernelModule

# Output tensors specifications (since they will be created on the fly)
output_specs = {
    'out1':(<shape>, <dtype>, <needs gradients ?>), 
    'out2':(<shape>, <dtype>, <needs gradients ?>)
    ...}

# Module creation
taichi_module = TaichiKernelModule(my_kernel, output_specs)

# Kernel input args (torch tensors and scalars)
in1 = ...
in2 = ...
...

# Module call
out1, out2, ... = taichi_module(in1, in2, ...) # kwargs of the taichi kernel inputs are supported 

# Loss function
loss = my_loss(out1, out2, ...)

# Gradient computation
loss.backward()

# Gradient descent
lr = 1e-3
in1 -= lr * in1.grad
in2 -= lr * in2.grad
...

Metadata

Release files for timod 0.0.17

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for timod 0.0.17
File Size Uploaded
timod-0.0.17.tar.gz 4.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for timod 0.0.17
File Interpreter ABI Platform
timod-0.0.17-py3-none-any.whl Python 3 none any Details

Total release size: 9.2 kB

Release files / timod-0.0.17.tar.gz

Download URL timod-0.0.17.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
6209fcefea9bbb4004f44a861bbdce7f600bcca31ce934c852e472b136796125
BLAKE2b-256 checksum
How to use checksums
9e0d42937cdd523b5f75b91020687e6a810248e2ced7a384731420ea490aeddd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.7

Release files / timod-0.0.17-py3-none-any.whl

Download URL timod-0.0.17-py3-none-any.whl
Size 4.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
099800374a85a1b6a87646857e1b2652dfe9b816b20f25f6d74f0d2c18abe8ab
BLAKE2b-256 checksum
How to use checksums
9a225077566ebf9991669f7ab815f5dbccd18ab4f1e49ec6b19cfe06722463f8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.7

Release history Release notifications | RSS feed

This release

0.0.17 This release

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page