Skip to main content

celnn

celnn is a Python library that makes Cellular Neural Networks (CelNNs) practical and reusable for scientific and engineering applications, providing a general computational framework for continuous-time, locally coupled nonlinear dynamical systems over regular grids, signals, and image-like arrays.

In this project, CelNN refers to this cellular dynamical-system model, not to Convolutional Neural Networks.

Installation

pip install celnn

Install only the optional capabilities you need:

pip install "celnn[scipy]"
pip install "celnn[image]"
pip install "celnn[viz]"
pip install "celnn[ga]"
pip install "celnn[torch]"
pip install "celnn[gpu]"

The existing compatibility bundle also remains available:

pip install "celnn[all]"

The all extra preserves the pre-existing SciPy/GPU/image/viz/GA bundle; PyTorch remains an explicit torch capability.

The torch API includes differentiable CelNN evolution and modular Hebbian/Oja fast-weight plasticity with explicit per-sequence state. See the plasticity guide.

Use device="gpu" to require GPU execution, device="auto" to try GPU and fall back to CPU, or device="cpu" for the default NumPy backend.

The classical network defaults to float64. Explicit dtype behavior remains compatibility-sensitive; native float32 and float64 execution paths are covered directly by the test suite. This consolidation does not impose a new float64-only restriction on the optional SciPy solve_ivp path.

Development

For the canonical development setup and local verification workflow, see CONTRIBUTING.md. The repository continues to provide its existing Conda development environment while Pyright is the maintained static type checker.

Quick start

import numpy as np
from celnn import CellularNetwork, SimulationConfig

u = np.random.rand(32, 32)

net = CellularNetwork(
    input=u,
    feedback=np.array([[0.0, 0.1, 0.0], [0.1, 1.0, 0.1], [0.0, 0.1, 0.0]]),
    control=np.array([[0.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 0.0]]),
    bias=0.0,
    boundary="reflect",
    device="auto",
)

result = net.run(SimulationConfig(t_end=1.0, dt=0.01))
print(result.output.shape)
print(result.convergence)

SimulationConfig.stability_checks and SimulationResult.convergence remain part of the established public interface. Scientific redesign of those diagnostics is intentionally separate from the current consolidation work.

Documentation shortcuts

Features

  • Generic CellularNetwork API for 1D, 2D, and SciPy-backed ND simulations.
  • Reusable Template and TemplateRegistry abstractions.
  • Built-in activation functions, boundary modes, and solver options.
  • Optional CuPy/CUDA backend for GPU local stencil aggregation.
  • Optional image, signal, grid, serialization, and visualization helpers.
  • Optional genetic-algorithm-based template trainer (DEAP).
  • Optional DifferentiableCellularNetwork with learnable PyTorch templates.
  • Optional PyTorch plasticity and associative-memory APIs.
  • Demonstrative built-in templates for image processing, logic, diffusion, and pattern formation.
  • Tests, examples, and technical documentation aimed at research and experimentation.

Persistence

The public JSON helpers in celnn.io.serialization preserve the established flat JSON representation and write files atomically. Loading remains compatible with previously accepted payloads rather than introducing a new schema envelope or stricter migration contract in this consolidation.

Saved network artifacts preserve model meaning, including dtype, but new writes do not bind the model to the backend/device on which it happened to run. Loaders continue accepting historical payloads containing those operational fields and loading defaults to CPU unless another device is explicitly requested.

Implementation status

  • Maturity: alpha; public contracts may intentionally evolve before 1.0, but compatibility changes should be explicit rather than incidental.
  • CI verifies the base package on every advertised Python version, runs package-wide Ruff/Pyright checks, exercises representative optional integrations and dependency floors, and smoke-tests built wheel/sdist artifacts.
  • The installed wheel ships py.typed and its public typing surface is verified from the built artifact.
  • GPU semantic parity is covered with deterministic backend tests; real CUDA claims require a CUDA-capable environment and are not inferred from stubs.

License

This repository is distributed under the Apache-2.0 license. See LICENSE.

Attribution

celnn is an original, generalized library design inspired in part by the MIT-licensed PyCNN project, which focused on image processing with Cellular Neural Networks.

Metadata

Release files for celnn 1.0.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 celnn 1.0.0
File Size Uploaded
celnn-1.0.0.tar.gz 73.1 kB Details

Built distribution (wheel)

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

Total release size: 143.5 kB

Release files / celnn-1.0.0.tar.gz

Download URL celnn-1.0.0.tar.gz
Size 73.1 kB
Tags Source
SHA-256 checksum
How to use checksums
19c3dcf9ba9d91f3772d679a36c6335df03ba5f69daaf66558f29acc55bd8344
BLAKE2b-256 checksum
How to use checksums
d965f9978b949b7055ac2c5d963d7b849e2eb08f37be103a4636dddeaebc04b2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 31, 2026.

Transparency log

Release files / celnn-1.0.0-py3-none-any.whl

Download URL celnn-1.0.0-py3-none-any.whl
Size 70.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0286ac08eb9ab15f696f524bcc7267d4e88680a27b2cc174caf3ad427f019874
BLAKE2b-256 checksum
How to use checksums
09143d756f59277bda5bb45ec24381b550914d8cadcd991a95437161683f4c13
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 31, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

0.3.2

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