hackwhiz
Tiny NumPy-based tensors, layers, and optimizers intended for teaching and quick experiments.
Features
- Lightweight
Tensorwrapper with handy creation helpers (rand,randn,zeros,ones,eye,arange) and NumPy interoperability. - Minimal neural network pieces:
Linear,Relu,CrossEntropy, and a simpleModuleinterface. - Straightforward SGD optimizer plus
DatasetandDataLoaderutilities for batching. - Pure Python on top of NumPy, so it runs anywhere NumPy does.
Installation
pip install hackwhiz
Quickstart
import hackwhiz as hw
from hackwhiz import nn, optim
hw.manual_seed(7)
class Model(nn.Module):
def __init__(self):
self.layers = [
nn.Linear(2, 4),
nn.Relu(),
nn.Linear(4, 2),
]
self.loss = nn.CrossEntropy()
def forward(self, x, targ):
for layer in self.layers:
x = layer(x)
return self.loss(x, targ)
def backward(self):
self.loss.backward()
for layer in reversed(self.layers):
layer.backward()
model = Model()
opt = optim.SGD(model.parameters(), lr=0.1)
x = hw.tensor([[1.0, 0.0], [0.0, 1.0], [1.0, 1.0], [0.0, 0.0]])
y = hw.tensor([0, 1, 0, 1])
for _ in range(50):
opt.zero_grad()
loss = model(x, y)
model.backward()
opt.step()
print(f"final loss: {loss.item():.4f}")
Development
- Create an environment and install in editable mode:
python -m venv .venv && source .venv/bin/activate && pip install -e .. - Run the example script above to sanity-check changes.
- Build a release:
pip install build twine && python -m buildthentwine check dist/*andtwine upload dist/*.
Metadata
Release files for hackwhiz 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| hackwhiz-0.1.1.tar.gz | 3.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| hackwhiz-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 6.9 kB
Release files / hackwhiz-0.1.1.tar.gz
| Download URL | hackwhiz-0.1.1.tar.gz |
|---|---|
| Size | 3.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c5c7eb6037b5d0cdb4b00e710b07ceffb1122f52c0e58168a81076a69f649c5c
|
|
BLAKE2b-256 checksum How to use checksums |
86edba8305d718c7f065e2211c593a1be6a69744a672c4c73c6cec8f2fb1a969
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.4
|
Release files / hackwhiz-0.1.1-py3-none-any.whl
| Download URL | hackwhiz-0.1.1-py3-none-any.whl |
|---|---|
| Size | 3.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ce1a33dcfa52fa4e258dc6cb774e31767e0e8d935e6b4613aa69b8a1a46016ec
|
|
BLAKE2b-256 checksum How to use checksums |
dad9329d86d789f3e539b36d6a85b384299220bcbafec8647319962d1208d7cb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.4
|
Security for hackwhiz 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.