Skip to main content

Mini Torch from Scratch

Un petit framework Python, sans dependance externe, pour l'autodiff scalaire et les reseaux fully connected (MLP). Il ne fournit pas encore de couches CNN.

Installation

python -m pip install mini-torch-from-scratch

Le nom du paquet sur PyPI est mini-torch-from-scratch. Le nom d'import Python reste mini_torch.

Exemple

from mini_torch import Couche, MLP, Neuron, Nombre

reseau = MLP(
    [
        Couche([Neuron([0.5, -0.2], 0.1)]),
        Couche([Neuron([0.8], 0.0)]),
    ]
)

sortie = reseau.propager([2.0, 1.0])[0]
perte = (sortie - 1.0) ** 2
perte.backward()

for parametre in reseau.parameters():
    parametre.h_val -= 0.01 * parametre.b_val

Nombre.backward() calcule les gradients et les accumule sur les feuilles du graphe. Remets les gradients des parametres a zero avant une nouvelle etape d'optimisation si tu ne veux pas les accumuler.

Pour voir un exemple d'entrainement complet depuis le depot :

python -m examples.entrainement

Tests

Depuis la racine du depot :

python -m unittest discover -s tests

Construire et publier sur PyPI

La publication n'est pas automatique. Pour publier toi-meme :

  1. Remplace le titulaire fictif dans LICENSE par ton nom ou celui de ton organisation, puis cree un compte PyPI et verifie que le nom mini-torch-from-scratch est toujours disponible. Sa disponibilite peut changer.

  2. Depuis la racine du depot, construis et verifies les distributions :

    python -m pip install --upgrade build twine
    python -m build
    python -m twine check dist/*
    
  3. Configure tes identifiants PyPI selon la documentation officielle de Twine, puis envoie les distributions :

    python -m twine upload dist/*
    

Ne place pas de jeton PyPI dans le code source ni dans le depot. Augmente la version dans pyproject.toml avant chaque nouvelle publication.

Metadata

Release files for mini-torch-from-scratch 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 mini-torch-from-scratch 0.1.0
File Size Uploaded Provenance Actions
mini_torch_from_scratch-0.1.0.tar.gz 4.8 kB Without provenance Details for mini_torch_from_scratch-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mini-torch-from-scratch 0.1.0
File Interpreter ABI Platform Actions
mini_torch_from_scratch-0.1.0-py3-none-any.whl Python 3 none any Details for mini_torch_from_scratch-0.1.0-py3-none-any.whl

Total release size: 9.8 kB

Release files / mini_torch_from_scratch-0.1.0.tar.gz

Download URL mini_torch_from_scratch-0.1.0.tar.gz
Size 4.8 kB
Tags Source
SHA-256 checksum
How to use checksums
2eec428e777bdc2a98845e52631591fd840457358de2068f959423a613efcac3
BLAKE2b-256 checksum
How to use checksums
b5a1359020c80bc5807d15e51227cbbdf7c43689f95c3d5ce8d40bb8c037f88b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

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

Download URL mini_torch_from_scratch-0.1.0-py3-none-any.whl
Size 5.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d96943f1e9cd7a6fce3cafc809a9b401ccb3c3cf909528616f675a9aacc49349
BLAKE2b-256 checksum
How to use checksums
87459c42b7b1c38ff44def4ec827a4cb8f79b4a35ab2bf43ce1e3d050ea721c8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Security for mini-torch-from-scratch 0.1.0

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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