{"id":40504073,"url":"https://github.com/genn-team/ml_genn","last_synced_at":"2026-01-20T19:13:15.304Z","repository":{"id":42371103,"uuid":"188994504","full_name":"genn-team/ml_genn","owner":"genn-team","description":"A library for deep learning with Spiking Neural Networks (SNN).","archived":false,"fork":false,"pushed_at":"2025-12-05T14:27:05.000Z","size":39381,"stargazers_count":36,"open_issues_count":42,"forks_count":11,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-12-05T14:34:24.369Z","etag":null,"topics":["deep-learning","genn","machine-learning","spiking-neural-networks"],"latest_commit_sha":null,"homepage":"https://ml-genn.readthedocs.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-2.1","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/genn-team.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-05-28T09:11:02.000Z","updated_at":"2025-12-05T10:53:54.000Z","dependencies_parsed_at":"2023-12-18T11:29:07.092Z","dependency_job_id":"21e490a7-c988-4b86-a054-126d4216142a","html_url":"https://github.com/genn-team/ml_genn","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/genn-team/ml_genn","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/genn-team%2Fml_genn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/genn-team%2Fml_genn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/genn-team%2Fml_genn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/genn-team%2Fml_genn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/genn-team","download_url":"https://codeload.github.com/genn-team/ml_genn/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/genn-team%2Fml_genn/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28609906,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-20T18:56:40.769Z","status":"ssl_error","status_checked_at":"2026-01-20T18:54:26.653Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deep-learning","genn","machine-learning","spiking-neural-networks"],"created_at":"2026-01-20T19:13:15.214Z","updated_at":"2026-01-20T19:13:15.291Z","avatar_url":"https://github.com/genn-team.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://gen-ci.inf.sussex.ac.uk/buildStatus/icon?job=GeNN/ml_genn/master)](https://gen-ci.inf.sussex.ac.uk/job/GeNN/job/ml_genn/job/master/) [![Docs](https://readthedocs.org/projects/ml-genn/badge)](https://ml-genn.readthedocs.io) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.7681736.svg)](https://doi.org/10.5281/zenodo.7681736) [![codecov](https://codecov.io/gh/genn-team/ml_genn/branch/master/graph/badge.svg?token=8X5YC1Z0YN)](https://codecov.io/gh/genn-team/ml_genn)\n\n# mlGeNN\nA library for deep learning with Spiking Neural Networks (SNN)powered by [GeNN](http://genn-team.github.io/genn/), a GPU enhanced Neuronal Network simulation environment.\n\n## Installation\n 1. Follow the instructions in https://genn-team.github.io/genn/documentation/5/installation.html to install PyGeNN.\n 2. Clone this project\n 3. Install mlGeNN with setuptools using ``pip install .`` command in the ``ml_genn`` directory\n 3. To use mlGeNN to convert ANNs trained with Keras to SNNs, install mlGeNN TF with setuptools using ``pip install .`` command in the ``ml_genn_tf`` directory\n\n## Usage\n### Convert ANN to SNN\nThe following example illustrates how to convert an ANN model, defined in Keras, to an SNN using the few-spike ([Stöckl \u0026 Maass, 2021](http://dx.doi.org/10.1038/s42256-021-00311-4)) conversion method:\n```python\nfrom tensorflow.keras.models import Sequential\nfrom tensorflow.keras.layers import *\ntf_model = Sequential([\n   Conv2D(16, 3, padding='same', activation='relu',\n          use_bias=False, input_shape=(32, 32, 3)),\n   AveragePooling2D(2),\n   Flatten(),\n   Dense(10, activation='relu', use_bias=False)])\n\n# compile and train tf_model with TensorFlow\n...\n\nfrom ml_genn_tf.converters import FewSpike\n\nconverter = FewSpike(k=8, signed_input=signed_input, norm_data=[x_subset])\nnet, net_inputs, net_outputs, tf_layer_pops = converter.convert(tf_model)\n\ncompiler = converter.create_compiler()\ncompiled_net = compiler.compile(net, inputs=net_inputs, outputs=net_outputs)\n\nwith compiled_net:\n    metrics, cb_data = compiled_net.evaluate({net_inputs[0]: validate_x},\n                                             {net_outputs[0]: validate_y})\n    print(f\"Accuracy = {100.0 * metrics[net_outputs[0]].result}%\")\n```\nFor further examples, please see the examples/tf folder.\n\n### Training an SNN using e-prop\nThe following example illustrates how to train a simple SNN with the e-prop learning rule ([Bellec, Scherr et al., 2020](http://dx.doi.org/10.1038/s41467-020-17236-y)):\n```python\nfrom ml_genn import InputLayer, Layer, SequentialNetwork\nfrom ml_genn.compilers import EPropCompiler\nfrom ml_genn.connectivity import Dense\nfrom ml_genn.initializers import Normal\nfrom ml_genn.neurons import LeakyIntegrate, LeakyIntegrateFire\n\nfrom ml_genn.compilers.eprop_compiler import default_params\n\n# load dataset\n...\n\nnetwork = SequentialNetwork(default_params)\nwith network:\n    # Populations\n    input = InputLayer(\"poisson_input\", 768)\n    Layer(Dense(Normal(sd=1.0 / np.sqrt(768))),\n                LeakyIntegrateFire(tau_refrac=5.0),\n                128)\n    output = Layer(Dense(Normal(sd=1.0 / np.sqrt(128))),\n                   LeakyIntegrate(),\n                   10)\n\ncompiler = EPropCompiler(example_timesteps=200,\n                         losses=\"sparse_categorical_crossentropy\",\n                         optimiser=\"adam\", batch_size=128)\ncompiled_net = compiler.compile(network)\n\nwith compiled_net:\n    metrics, _  = compiled_net.train({input: x},\n                                     {output: y},\n                                     num_epochs=10, shuffle=True)\n    print(f\"Accuracy = {100 * metrics[output].result}%\")\n```\n\nFor further examples, please see the examples/eprop folder.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgenn-team%2Fml_genn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgenn-team%2Fml_genn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgenn-team%2Fml_genn/lists"}