Skip to main content

Python bindings for the Shrew deep learning library

Project description

shrew-python

Python bindings for Shrew, a modular deep learning framework written in Rust.

Features

  • High Performance: Native Rust implementation with minimal Python overhead.
  • GPU Support: CUDA acceleration via shrew-cuda (if valid CUDA toolkit is present).
  • Declarative Models: Full support for Shrew's .sw intermediate representation.
  • Autograd: Reverse-mode automatic differentiation.
  • Interoperability: Zero-copy tensor conversion from/to NumPy.

Installation

pip install shrew-python

Usage

import shrew_python as shrew

# Create tensors
x = shrew.tensor([1.0, 2.0, 3.0])
y = shrew.tensor([4.0, 5.0, 6.0])

# Operations
z = x + y
print(z)  # Tensor([5.0, 7.0, 9.0], dtype=F64, dev=Cpu)

# Load a .sw model
executor = shrew.Executor.load("my_model.sw")
result = executor.run("forward", {"input": x})

Building from Source

Requires Rust and Maturin.

git clone https://github.com/ginozza/shrew
cd shrew
maturin develop --manifest-path crates/shrew-python/Cargo.toml --release

License

Apache-2.0

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

shrew_python-0.1.0.tar.gz (369.9 kB view details)

Uploaded Source

Built Distribution

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

shrew_python-0.1.0-cp314-cp314-win_amd64.whl (1.1 MB view details)

Uploaded CPython 3.14Windows x86-64

File details

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

File metadata

  • Download URL: shrew_python-0.1.0.tar.gz
  • Upload date:
  • Size: 369.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.12.2

File hashes

Hashes for shrew_python-0.1.0.tar.gz
Algorithm Hash digest
SHA256 78f3d5ad430047f3e48579abd44f972d566fd7df65b6ef65f7f261da2049818f
MD5 75025c18dc6c3525e4f138229ca1684f
BLAKE2b-256 d2c4ec34a229a4c90283c947319a38136d1fc5dc12267a6afdd790aa04487fad

See more details on using hashes here.

File details

Details for the file shrew_python-0.1.0-cp314-cp314-win_amd64.whl.

File metadata

File hashes

Hashes for shrew_python-0.1.0-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 25e96d6be85e973a41894f51f6ab580fc46cc4bffb892e6df8dd725572231376
MD5 38b78852ee5c181e8b89ab49b7d35750
BLAKE2b-256 9ab65526222467acf81faacc46275bc7f725c4883b408fa5562d921ea169bba8

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