Skip to main content

No project description provided

Project description

Pytorch extension written in rust

A demo pytorch (2.3.0) package using maturin and tch.

Build in a venv

# Create and activate a venv
python -m venv .venv
source .venv/bin/activate
# Install maturin
pip install maturin
# Build the torch_lib_with_rust package with maturin
LIBTORCH_USE_PYTORCH=1 maturin develop

Run

import torch
import torch_lib_with_rust

a=torch.randn(16).to("cuda")

print(a)
print(torch_lib_with_rust.add_one(a))

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

torch_lib_with_rust-0.1.1.tar.gz (7.9 kB view hashes)

Uploaded Source

Built Distribution

torch_lib_with_rust-0.1.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (329.6 kB view hashes)

Uploaded CPython 3.8+ manylinux: glibc 2.17+ x86-64

Supported by

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