Skip to main content

A simple deep learning framework built upon numpy only

Project description

deep-atomic

A simple deep learning framework built upon numpy only. Mainly for practice and learning.

Usage

Import

import deep_atomic as da
import numpy as np   # required for tensor initialization and some operations

Creating a Tensor

# Create a tensor from a NumPy array (requires_grad=True by default)
a = da.Tensor(
    np.array([1, 2, 3], dtype=np.float64),
    requires_grad=True
)

Supported Operations

Most essential deep‑learning operations are implemented. For those that also exist in NumPy, we follow NumPy's API conventions.

a, b = da.Tensor(np.random.rand(3, 4)), da.Tensor(np.random.rand(3, 4))

# Arithmetic & math
c = a + b                     # addition
c = a - b                     # subtraction
c = a * b                     # element‑wise multiplication
c = a / b                     # element‑wise division
c = a ** b                    # element‑wise power
c = a @ b                     # matrix multiplication
c = da.exp(a)
c = da.log(a)

# Reductions
c = da.sum(a)                               # shape: (1,)
c = da.sum(a, axis=1)                       # shape: (3,)
c = da.sum(a, axis=1, keepdims=True)        # shape: (3, 1)
# min, max, argmin, argmax follow the same signature

# Softmax
c = da.softmax(a, axis=-1)
c = da.log_softmax(a, axis=-1)

# Shape manipulations
c = a.reshape(2, 6)
c = a.reshape(1, 12).squeeze(0)               # shape: (12,)
c = da.expand_dims(a, -1)                   # shape: (3, 4, 1)
c = a.expand_dims(-1)                         # method‑style alternative
c = a.repeat(2, axis=1)                       # shape: (3, 8)
c = da.tile(a, (2, 2))                      # shape: (6, 8)
c = a.tile(2, 2)                              # method‑style alternative

Todo

  • more basic operations and their autograd
    • convolution and 2d convolution
    • topk
    • boolean and masked operation
    • einsum
    • scatter
  • basic neural network classes
  • optimizers and loss functions
  • full training test
  • benchmark with pytorch on CPU
  • attention layers and full LLM training
  • finer type annotations, comments and documentation

Installation

pip install deep-atomic

# or with uv
uv add deep-atomic

Development

Install in editable mode with development dependencies:

pip install -e ".[dev]"

Run tests:

pytest

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

deep_atomic-0.1.1.tar.gz (85.7 kB view details)

Uploaded Source

Built Distribution

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

deep_atomic-0.1.1-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

Details for the file deep_atomic-0.1.1.tar.gz.

File metadata

  • Download URL: deep_atomic-0.1.1.tar.gz
  • Upload date:
  • Size: 85.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for deep_atomic-0.1.1.tar.gz
Algorithm Hash digest
SHA256 399d8798a6c9a7a3642662b6b6893f0b87fbbeb6666a47433e9a29a03bb79406
MD5 2f04386199667c93065edbcb73665b14
BLAKE2b-256 0b8753d3291ff911510175037850f26f7dea9a67437818ac2e69a7e0d4310f02

See more details on using hashes here.

Provenance

The following attestation bundles were made for deep_atomic-0.1.1.tar.gz:

Publisher: publish-pypi.yml on elliot-zzh/deep-atomic

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file deep_atomic-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: deep_atomic-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for deep_atomic-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ce8604a9dd9dbfd91af4338055996d89208188cfbbe16f6ce9b149a7a6495af1
MD5 a2ccc0bc400ac1c930d8a2a81b52b647
BLAKE2b-256 5ad59309b4c41b6fcf0e1bf29489b8e6126240ecc1c0b0cbac02410a19d6062f

See more details on using hashes here.

Provenance

The following attestation bundles were made for deep_atomic-0.1.1-py3-none-any.whl:

Publisher: publish-pypi.yml on elliot-zzh/deep-atomic

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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