{"id":15680858,"url":"https://github.com/luca-parisi/quantum_relu","last_synced_at":"2025-05-07T09:26:10.351Z","repository":{"id":183789349,"uuid":"305300732","full_name":"luca-parisi/quantum_relu","owner":"luca-parisi","description":"QReLU and m-QReLU: Two novel quantum activation functions for Deep Learning in TensorFlow, Keras, and PyTorch","archived":false,"fork":false,"pushed_at":"2024-09-02T22:19:10.000Z","size":45,"stargazers_count":14,"open_issues_count":0,"forks_count":7,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-19T20:53:46.228Z","etag":null,"topics":["activation","activation-functions","deep-learning","deep-neural-networks","keras","keras-classification-models","keras-models","keras-neural-networks","keras-tensorflow","neural-network","neural-networks","pytorch","quantum","quantum-algorithms","quantum-machine-learning","relu","relu-activation","relu-layer","tensorflow","torch"],"latest_commit_sha":null,"homepage":"https://bradscholars.brad.ac.uk/handle/10454/18613","language":"Python","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/luca-parisi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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}},"created_at":"2020-10-19T07:36:23.000Z","updated_at":"2024-12-27T22:42:44.000Z","dependencies_parsed_at":null,"dependency_job_id":"696b3f29-3d54-48e3-8fac-49c8fab80f87","html_url":"https://github.com/luca-parisi/quantum_relu","commit_stats":null,"previous_names":["luca-parisi/quantum_relu"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luca-parisi%2Fquantum_relu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luca-parisi%2Fquantum_relu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luca-parisi%2Fquantum_relu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luca-parisi%2Fquantum_relu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/luca-parisi","download_url":"https://codeload.github.com/luca-parisi/quantum_relu/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252849647,"owners_count":21813838,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["activation","activation-functions","deep-learning","deep-neural-networks","keras","keras-classification-models","keras-models","keras-neural-networks","keras-tensorflow","neural-network","neural-networks","pytorch","quantum","quantum-algorithms","quantum-machine-learning","relu","relu-activation","relu-layer","tensorflow","torch"],"created_at":"2024-10-03T16:45:09.745Z","updated_at":"2025-05-07T09:26:10.308Z","avatar_url":"https://github.com/luca-parisi.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# QReLU and m-QReLU in TensorFlow, Keras, and PyTorch\n## Two novel quantum activation functions\n\nThe Quantum ReLU **'QReLU'** and its modified version or **'m-QReLU'** are Python custom activation functions available for both shallow and deep neural networks in TensorFlow, Keras, and PyTorch for Machine Learning- and Deep Learning-based classification. They are distributed under the [CC BY 4.0 license](http://creativecommons.org/licenses/by/4.0/).\n\nDetails on these functions, implementations, and validations against gold standard activation functions for both shallow and deep neural networks are available at the papers: **[Parisi, L., 2020](https://arxiv.org/abs/2010.08031)** and **[Parisi, L., et al., 2022](https://www.sciencedirect.com/science/article/abs/pii/S0957417421012483)**. \n\n\n### Dependencies\n\nThe dependencies are included in the `environment.yml` file. \nRun the following command to install the required version of Python (v3.9.16) and all dependencies in a conda virtual \nenvironment (replace `\u003cenv_name\u003e` with your environment name):\n\n- `conda create --name \u003cenv_name\u003e --file environment.yml`\n\n\n### Usage\nRun ` pip install -e .` to install the `src` package in editable mode.\n\nYou can use the `QuantumReLU` activation functions as a keras layer and set the `modified` attribute to either `False` \nor `True` if using the QReLU or the m-QReLU respectively:\n\n#### Example of usage in a sequential model in Keras with a `QuantumReLU` layer between a convolutional layer and a pooling layer\n\nEither\n\n```python\nmodel = models.Sequential()\nmodel.add(layers.Conv2D(32, (3, 3), input_shape=(32, 32, 3)))\nmodel.add(QuantumReLU(modified=False))  # True if using the m-QReLU (instead of the QReLU)\nmodel.add(layers.MaxPooling2D((2, 2)))\n```\n\nor\n\n```python\nmodel = keras.Sequential(\n        keras.Input(shape=(32, 32, 3)),\n\n        layers.Conv2D(32, kernel_size=(3, 3)),\n        QuantumReLU(modified=False),  # True if using the m-QReLU (instead of the QReLU)\n\n        layers.MaxPooling2D(pool_size=(2, 2)),\n    ]\n)\n```\n\n#### Example of usage in a sequential model in PyTorch with a `QuantumReLU` layer between a convolutional layer and a pooling layer\n\n```python\nself.conv1 = nn.Conv2d(1, 32, kernel_size=3)\nself.relu1 = QuantumReLU(modified=False)  # True if using the m-QReLU (instead of the QReLU)\nself.pool1 = nn.MaxPool2d(kernel_size=2)\n```\n\n### Linting\n`isort` is used to ensure a consistent order of imports, whilst `autopep8` to ensure adherence of the codes to PEP-8, \nvia the following two commands respectively:\n\n- `isort \u003cfolder_name\u003e`\n- `autopep8 --in-place --recursive .`\n\n### Unit testing\nRun `pytest --cov-report term-missing --cov=src tests/` to execute all unit tests and view the report with the test \ncoverage in percentage and missing lines too.\n\n### Citation request\n\nIf you use these activation functions, please cite the papers by **[Parisi, L., 2020](https://arxiv.org/abs/2010.08031)** and **[Parisi, L., et al., 2022](https://www.sciencedirect.com/science/article/abs/pii/S0957417421012483)**.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluca-parisi%2Fquantum_relu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fluca-parisi%2Fquantum_relu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluca-parisi%2Fquantum_relu/lists"}