Skip to main content

Heroch: High-Performance Deep Learning and Scientific Computing Library

PyPI version License: MIT

Heroch is a powerful, flexible, and intuitive Python library designed for machine learning, deep learning, and scientific computing. It provides a high-performance tensor computation platform with seamless GPU acceleration (via CUDA/CuPy) and a dynamic automatic differentiation (autograd) engine.

Why Heroch?

Heroch is built to feel like a native Python library, integrating perfectly with the SciPy ecosystem. Whether you are conducting academic research or building production-level neural networks, Heroch offers the flexibility to experiment and the speed to scale.

Key Features

  • ⚡ High-Performance Tensor Computations: Native NumPy interface with optional GPU acceleration for massive speedups.
  • 🧠 Dynamic Autograd Engine: Flexible computational graphs that allow you to change network structures on the fly.
  • 🛠️ Complete Deep Learning Platform: Built-in modules for linear layers, common activations (ReLU, Sigmoid), and loss functions (MSELoss).
  • 🚀 Optimized Training: Robust optimizers including Stochastic Gradient Descent (SGD) with momentum.
  • 🐍 Pythonic API: Intuitive design that is easy to debug and executes code as you write it.

Installation

Install Heroch easily via pip:

pip install heroch

Note: For GPU support, ensure you have an NVIDIA GPU and the appropriate CUDA drivers installed.

Quick Start Example

Build and train a simple neural network in minutes:

import heroch
import heroch.nn as nn
import heroch.optim as optim
from heroch import Tensor

# Define your flexible model structure
class MyNeuralNetwork(nn.Module):
    def __init__(self):
        super().__init__()
        self.fc1 = nn.Linear(2, 4)
        self.relu = nn.ReLU()
        self.fc2 = nn.Linear(4, 1)
        
    def forward(self, x):
        x = self.relu(self.fc1(x))
        return self.fc2(x)

# Initialize model, loss, and optimizer
model = MyNeuralNetwork()
criterion = nn.MSELoss()
optimizer = optim.SGD(model.parameters(), lr=0.01, momentum=0.9)

# Training data
inputs = Tensor([[1.0, 2.0], [3.0, 4.0]])
targets = Tensor([[5.0], [11.0]])

# Training loop
for epoch in range(100):
    optimizer.zero_grad()
    predictions = model(inputs)
    loss = criterion(predictions, targets)
    loss.backward()
    optimizer.step()
    
    if epoch % 10 == 0:
        print(f"Epoch {epoch}, Loss: {loss.data}")

Advanced Usage: GPU Acceleration

Heroch makes it easy to move your computations to the GPU:

# Move model parameters and data to GPU
x_gpu = Tensor([1.0, 2.0, 3.0]).to_gpu()

Contributing

We welcome contributions from the community! Check out our GitHub repository to get involved.


Developed with 🔥 by Death Legion Team.

Metadata

Release files for heroch 0.1.0

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

Source distribution (sdist)

Source distribution for heroch 0.1.0
File Size Uploaded
heroch-0.1.0.tar.gz 9.0 kB Details

Built distribution (wheel)

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

Total release size: 17.4 kB

Release files / heroch-0.1.0.tar.gz

Download URL heroch-0.1.0.tar.gz
Size 9.0 kB
Tags Source
SHA-256 checksum
How to use checksums
39bb42fad3197809d7ea24cd0c76d853cd9843ab7cc13cc86c87f8440a625a5d
BLAKE2b-256 checksum
How to use checksums
6e317e24fa8ccaa82fb77c5049943f9ab796fb9e7d1a912cc41746fe78f45648
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Release files / heroch-0.1.0-py3-none-any.whl

Download URL heroch-0.1.0-py3-none-any.whl
Size 8.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dc32f163465624011e31df1468657f711480b6bf7223b6a0c680981be4eb40b1
BLAKE2b-256 checksum
How to use checksums
1ad10a9571895ac8e7e0fd0076c6e2ff8a163173e755a6fa1bf605e4b441e3cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Release history Release notifications | RSS feed

This release

0.1.0 This release

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