{ "info": { "author": "Plumerai", "author_email": "lukas@plumerai.co.uk", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "Intended Audience :: Education", "Intended Audience :: Science/Research", "License :: OSI Approved :: Apache Software License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3 :: Only", "Topic :: Scientific/Engineering", "Topic :: Scientific/Engineering :: Artificial Intelligence", "Topic :: Scientific/Engineering :: Mathematics", "Topic :: Software Development", "Topic :: Software Development :: Libraries", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "\"logo\"\n
\n\n[![](https://github.com/larq/larq/workflows/Unittest/badge.svg)](https://github.com/larq/larq/actions?workflow=Unittest) [![Codecov](https://img.shields.io/codecov/c/github/larq/larq)](https://codecov.io/github/larq/larq?branch=master) [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/larq.svg)](https://pypi.org/project/larq/) [![PyPI](https://img.shields.io/pypi/v/larq.svg)](https://pypi.org/project/larq/) [![PyPI - License](https://img.shields.io/pypi/l/larq.svg)](https://github.com/larq/larq/blob/master/LICENSE) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black) [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/larq/larq/master?filepath=docs%2Fexamples) [![Join the community on Spectrum](https://withspectrum.github.io/badge/badge.svg)](https://spectrum.chat/larq)\n\nLarq is an open-source deep learning library for training neural networks with extremely low precision weights and activations, such as Binarized Neural Networks (BNNs).\n\nExisting deep neural networks use 32 bits, 16 bits or 8 bits to encode each weight and activation, making them large, slow and power-hungry. This prohibits many applications in resource-constrained environments. Larq is the first step towards solving this. It is designed to provide an easy to use, composable way to train BNNs (1 bit) and other types of Quantized Neural Networks (QNNs) and is based on the `tf.keras` interface.\n\n## Getting Started\n\nTo build a QNN, Larq introduces the concept of [quantized layers](https://larq.dev/api/layers/) and [quantizers](https://larq.dev/api/quantizers/). A quantizer defines the way of transforming a full precision input to a quantized output and the pseudo-gradient method used for the backwards pass. Each quantized layer requires an `input_quantizer` and a `kernel_quantizer` that describe the way of quantizing the incoming activations and weights of the layer respectively. If both `input_quantizer` and `kernel_quantizer` are `None` the layer is equivalent to a full precision layer.\n\nYou can define a simple binarized fully-connected Keras model using the [Straight-Through Estimator](https://larq.dev/api/quantizers/#ste_sign) the following way:\n\n```python\nmodel = tf.keras.models.Sequential([\n tf.keras.layers.Flatten(),\n larq.layers.QuantDense(512,\n kernel_quantizer=\"ste_sign\",\n kernel_constraint=\"weight_clip\"),\n larq.layers.QuantDense(10,\n input_quantizer=\"ste_sign\",\n kernel_quantizer=\"ste_sign\",\n kernel_constraint=\"weight_clip\",\n activation=\"softmax\")])\n```\n\nThis layer can be used inside a [Keras model](https://www.tensorflow.org/alpha/guide/keras/overview#sequential_model) or with a [custom training loop](https://www.tensorflow.org/alpha/guide/keras/overview#model_subclassing).\n\n## Examples\n\nCheck out our examples on how to train a Binarized Neural Network in just a few lines of code:\n\n- [Introduction to BNNs with Larq](https://larq.dev/examples/mnist/)\n- [BinaryNet on CIFAR10](https://larq.dev/examples/binarynet_cifar10/)\n- [BinaryNet on CIFAR10 (Advanced)](https://larq.dev/examples/binarynet_advanced_cifar10/)\n\n## Installation\n\nBefore installing Larq, please install:\n\n- [Python](https://python.org) version `3.6` or `3.7`\n- [Tensorflow](https://www.tensorflow.org/install) version `1.13`, `1.14`, `1.15` or `2.0.0`:\n ```shell\n pip install tensorflow # or tensorflow-gpu\n ```\n\nYou can install Larq with Python's [pip](https://pip.pypa.io/en/stable/) package manager:\n\n```shell\npip install larq\n```\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://larq.dev/", "keywords": "", "license": "Apache 2.0", "maintainer": "", "maintainer_email": "", "name": "larq", "package_url": "https://pypi.org/project/larq/", "platform": "", "project_url": "https://pypi.org/project/larq/", "project_urls": { "Homepage": "https://larq.dev/" }, "release_url": "https://pypi.org/project/larq/0.7.4/", "requires_dist": [ "numpy (<2.0,>=1.15.4)", "terminaltables (>=3.1.0)", "dataclasses ; python_version < \"3.7\"", "mkdocs (==1.0.4) ; extra == 'docs'", "mkdocs-material (==4.4.3) ; extra == 'docs'", "pymdown-extensions (==6.1) ; extra == 'docs'", "mknotebooks (==0.1.7) ; extra == 'docs'", "mkdocs-minify-plugin (==0.2.1) ; extra == 'docs'", "larq-zoo (==0.4.2) ; extra == 'docs'", "altair (==3.2.0) ; extra == 'docs'", "pandas (==0.25.1) ; extra == 'docs'", "tensorflow (>=1.13.1) ; extra == 'tensorflow'", "tensorflow-gpu (>=1.13.1) ; extra == 'tensorflow_gpu'", "absl-py (==0.8.1) ; extra == 'test'", "pytest (==5.2.1) ; extra == 'test'", "pytest-cov (==2.8.1) ; extra == 'test'", "snapshottest (==0.5.1) ; extra == 'test'" ], "requires_python": ">=3.6", "summary": "An Open Source Machine Learning Library for Training Binarized Neural Networks", "version": "0.7.4" }, "last_serial": 5972818, "releases": { "0.1.1": [ { "comment_text": "", "digests": { "md5": "8eea1b3ec4d05953c4f77c2b5858a8dc", "sha256": "6dc6637090f24f4666dd6618702bb7b6a8ccea776546ee0d0057a12a1e838f9d" }, "downloads": -1, "filename": "larq-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "8eea1b3ec4d05953c4f77c2b5858a8dc", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 26116, "upload_time": "2019-04-11T09:49:32", "url": "https://files.pythonhosted.org/packages/d7/d9/962f4b56f379298da59123871a98d7af0ebb3fc65db1e85b9db2d7fad10b/larq-0.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "09d9eaea424c3a83d4888c65c19b18a3", "sha256": "4d63a1940aefa8cfe0b2b7cdb843bf39a3789ab4ee9a26a31b09e918a0ebde39" }, "downloads": -1, "filename": "larq-0.1.1.tar.gz", "has_sig": false, "md5_digest": "09d9eaea424c3a83d4888c65c19b18a3", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 18878, "upload_time": "2019-04-11T09:49:33", "url": "https://files.pythonhosted.org/packages/14/9b/45eae70f401039d81c1c4106f7bb8cc9a5697571abf1d1a985f46555662b/larq-0.1.1.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "6b019d143aec3723d6ac025307e9d062", "sha256": "7d0aa81faaf9736698a46c2ba6bdb02af90ac96bc23e6820796185e027ed7668" }, "downloads": -1, "filename": "larq-0.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "6b019d143aec3723d6ac025307e9d062", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 27666, "upload_time": "2019-05-30T17:00:21", "url": "https://files.pythonhosted.org/packages/81/e7/1e70dc6d08c3b3f962b664067b9b5114cbc42397b7dde8dd2a7a7a7e1272/larq-0.2.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7c9f1428158f69372c09ea60c2493b38", "sha256": "15943e7f3813938a95673d8f0618e242ccfdef96ae02bdefa7ce11c04cee0914" }, "downloads": -1, "filename": "larq-0.2.0.tar.gz", "has_sig": false, "md5_digest": "7c9f1428158f69372c09ea60c2493b38", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 20617, "upload_time": "2019-05-30T17:00:23", "url": "https://files.pythonhosted.org/packages/de/51/0b5dfbbe987532de5b12045b660d0004d0fbefbb6d20f8bb0a89c4949124/larq-0.2.0.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "bcec917662f7421063e9827220e86259", "sha256": "03422c2bc1a7753bebb07527706f0c9ba83f1185462486192411752332c91309" }, "downloads": -1, "filename": "larq-0.3.0-py3-none-any.whl", "has_sig": false, "md5_digest": "bcec917662f7421063e9827220e86259", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 33472, "upload_time": "2019-06-27T20:25:00", "url": "https://files.pythonhosted.org/packages/8d/c7/adcadb1670402d48e4f5b5fb6ed5de69380abb6ba4ee3dab859ade3c8e99/larq-0.3.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "589712152e40053eb4be0811b1bbaca2", "sha256": "84f672548ec4cd58f79aab3bee8d44ece8af0b75b027a481c265e6a4a1ab0273" }, "downloads": -1, "filename": "larq-0.3.0.tar.gz", "has_sig": false, "md5_digest": "589712152e40053eb4be0811b1bbaca2", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 24214, "upload_time": "2019-06-27T20:25:02", "url": "https://files.pythonhosted.org/packages/f6/f9/1840e155be3558faff79f6ca0051b08584ffc5da00e2784b7635fcc312b0/larq-0.3.0.tar.gz" } ], "0.4.0": [ { "comment_text": "", "digests": { "md5": "9c96635fa73c160a5815977e014f646c", "sha256": "5a0cf1ad2a0762b1282ecb369ca6acbcf594026c8ef38c8298607fc1c4820472" }, "downloads": -1, "filename": "larq-0.4.0-py3-none-any.whl", "has_sig": false, "md5_digest": "9c96635fa73c160a5815977e014f646c", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 38221, "upload_time": "2019-07-09T16:12:56", "url": "https://files.pythonhosted.org/packages/c0/31/3ebdeaae35c6733b431d094c8cc96cbffc2be7a72bab7566b7e720516dd5/larq-0.4.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f83db8a5f29eff8d2b38100533764b31", "sha256": "44dc429ebfda436fa4283f50f7e79bb817628f496dd0c45c8570a9c4af65bdc4" }, "downloads": -1, "filename": "larq-0.4.0.tar.gz", "has_sig": false, "md5_digest": "f83db8a5f29eff8d2b38100533764b31", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 28765, "upload_time": "2019-07-09T16:12:58", "url": "https://files.pythonhosted.org/packages/80/b4/4199edb50d1608af56b32f3c2f56f729a82e991d1eb2b31a7f5e7f5d1594/larq-0.4.0.tar.gz" } ], "0.5.0": [ { "comment_text": "", "digests": { "md5": "5c26c8208019cb48b21cd7b6bd9b4fa9", "sha256": "85b3bb6b150c4205941c532813fafa038d0c1bc7a6f4111055dd47eb8bbbd262" }, "downloads": -1, "filename": "larq-0.5.0-py3-none-any.whl", "has_sig": false, "md5_digest": "5c26c8208019cb48b21cd7b6bd9b4fa9", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 38262, "upload_time": "2019-07-12T18:13:26", "url": "https://files.pythonhosted.org/packages/ac/8c/ae3a88bfd369772580c56bf5e670719fb192415d6439022b73903c30a3f4/larq-0.5.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "81b920ea8aebf13bad9eaa3c50a0cefb", "sha256": "2655679a893422189eba26a2e054fe9b3a35082440cf71dc4b6f8351d068a91f" }, "downloads": -1, "filename": "larq-0.5.0.tar.gz", "has_sig": false, "md5_digest": "81b920ea8aebf13bad9eaa3c50a0cefb", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 28832, "upload_time": "2019-07-12T18:13:28", "url": "https://files.pythonhosted.org/packages/3f/c0/276914683ebc8a1f22653a49b66f807c5089e0f24e83314b8dd7b90fe220/larq-0.5.0.tar.gz" } ], "0.6.0": [ { "comment_text": "", "digests": { "md5": "8848dac94bd4581912113f0f1afcdead", "sha256": "269767683b84b421c2b2d23d2b6555c0172bb456c59894c8c943ece066aba413" }, "downloads": -1, "filename": "larq-0.6.0-py3-none-any.whl", "has_sig": false, "md5_digest": "8848dac94bd4581912113f0f1afcdead", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 42462, "upload_time": "2019-08-02T17:01:26", "url": "https://files.pythonhosted.org/packages/6b/36/77a28594de09f0a690b12ac2660815353a5383819977205e94c044dbe409/larq-0.6.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9e2c9c017476020bd5cedb1c0d857e3c", "sha256": "14b6aadbce2f1e4eb61b2bfc96cd11a384cddf04a653ee847b2a9af5286b66a3" }, "downloads": -1, "filename": "larq-0.6.0.tar.gz", "has_sig": false, "md5_digest": "9e2c9c017476020bd5cedb1c0d857e3c", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 32345, "upload_time": "2019-08-02T17:01:28", "url": "https://files.pythonhosted.org/packages/4e/da/26e31146d2c4eada0f4d23b8d3a79794d02ea7590a07d3e865ab2b3c7188/larq-0.6.0.tar.gz" } ], "0.7.0": [ { "comment_text": "", "digests": { "md5": "545b5a16b05dc0a61261d22809e01368", "sha256": "424cbf33cca9d65cc78f0c67817c4f8d9061d3d0263ec20b3deaced3075e1686" }, "downloads": -1, "filename": "larq-0.7.0-py3-none-any.whl", "has_sig": false, "md5_digest": "545b5a16b05dc0a61261d22809e01368", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 44618, "upload_time": "2019-08-30T17:07:31", "url": "https://files.pythonhosted.org/packages/0d/d3/acb30c2a248f61a5d782314ac9cd95b7def7928ce541ca100752c4e74383/larq-0.7.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "015c119ef8b942b741bddf9dd93f81ba", "sha256": "9bd8593c64a2ebd093c52822881732ccd15a3b67fd5b1803c8f55ca5f68bbc50" }, "downloads": -1, "filename": "larq-0.7.0.tar.gz", "has_sig": false, "md5_digest": "015c119ef8b942b741bddf9dd93f81ba", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 34139, "upload_time": "2019-08-30T17:07:33", "url": "https://files.pythonhosted.org/packages/df/f4/2fbb7ea8c2883dc6b31f33aa1d421cc9a7a2578abe54c7d61a3aa287dd40/larq-0.7.0.tar.gz" } ], "0.7.1": [ { "comment_text": "", "digests": { "md5": "4b35ea21188453410524ce906a574910", "sha256": "9422fb38a133d5d515c5ab884869f98340e9fa55c5b256823a194b56f845d2c8" }, "downloads": -1, "filename": "larq-0.7.1-py3-none-any.whl", "has_sig": false, "md5_digest": "4b35ea21188453410524ce906a574910", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 44688, "upload_time": "2019-09-08T15:39:52", "url": "https://files.pythonhosted.org/packages/03/a5/57de72d940107a6b165261da45533a0406da4efca94ec1d52127a68924db/larq-0.7.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "bf7a2feea299910f4e5a040a7ab8a9ec", "sha256": "2d913e9b878d78afc01c8003a1ce1ba39e30c6419bcde7df279d7ae6c29604d2" }, "downloads": -1, "filename": "larq-0.7.1.tar.gz", "has_sig": false, "md5_digest": "bf7a2feea299910f4e5a040a7ab8a9ec", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 34254, "upload_time": "2019-09-08T15:39:54", "url": "https://files.pythonhosted.org/packages/97/dc/1b6308889b2e1e0adfedb22ae7ee0f07d0f8aacad8d410b75f569f1b1273/larq-0.7.1.tar.gz" } ], "0.7.2": [ { "comment_text": "", "digests": { "md5": "e64b1e83c949cf3398dd90e88ae2d173", "sha256": "db87806594b70183b3ae6d5a05aa3d56be48256374d5656111bf0a32cb0d24f5" }, "downloads": -1, "filename": "larq-0.7.2-py3-none-any.whl", "has_sig": false, "md5_digest": "e64b1e83c949cf3398dd90e88ae2d173", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 45797, "upload_time": "2019-09-25T11:18:39", "url": "https://files.pythonhosted.org/packages/40/11/e57bbbb8799416e23bb63b3886fe4957cd7cde244c8aab82ac8a55a082cb/larq-0.7.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "65a9bd9cb3fea5890bf64ad720803118", "sha256": "1ff3b82ddad91011abee367088f5b767c297242565ac74b794ce40174fb4b3fb" }, "downloads": -1, "filename": "larq-0.7.2.tar.gz", "has_sig": false, "md5_digest": "65a9bd9cb3fea5890bf64ad720803118", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 34641, "upload_time": "2019-09-25T11:18:41", "url": "https://files.pythonhosted.org/packages/d5/8d/e44b75b03bfe3992fbe0d5004e7a861630b927066a4d8d2c3fcf8bc25cc7/larq-0.7.2.tar.gz" } ], "0.7.3": [ { "comment_text": "", "digests": { "md5": "5a6422d945005e64295ede7424c3815e", "sha256": "7c05473314a4c56119b6f5a6e6693c168db107ece71e8827722e8b553e5511b7" }, "downloads": -1, "filename": "larq-0.7.3-py3-none-any.whl", "has_sig": false, "md5_digest": "5a6422d945005e64295ede7424c3815e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 45920, "upload_time": "2019-10-02T14:04:43", "url": "https://files.pythonhosted.org/packages/02/65/62711492845cfd6ef5dfc5a02687b2bac02793cdf5ce5f6c719bce8bfd82/larq-0.7.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6629d1b3f2cd5b37ff2afa071513a087", "sha256": "eac3f52798035aae75641bbe5b7beb76be8934f6fc5ee4bc9bf8452b97f8d4e9" }, "downloads": -1, "filename": "larq-0.7.3.tar.gz", "has_sig": false, "md5_digest": "6629d1b3f2cd5b37ff2afa071513a087", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 35531, "upload_time": "2019-10-02T14:04:44", "url": "https://files.pythonhosted.org/packages/5e/e1/c22071d446816a5de72cb20cf15b61965ae10a4d0c2687eb2f0a35650948/larq-0.7.3.tar.gz" } ], "0.7.4": [ { "comment_text": "", "digests": { "md5": "57772c7f11aae42afca9128c9e722c47", "sha256": "30901954db26110d63ecc8612407b511fe91bd41a87dbd4050a03178709210af" }, "downloads": -1, "filename": "larq-0.7.4-py3-none-any.whl", "has_sig": false, "md5_digest": "57772c7f11aae42afca9128c9e722c47", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 46519, "upload_time": "2019-10-14T18:30:57", "url": "https://files.pythonhosted.org/packages/3f/26/5d7d6b15a38b9a7df4d66db9b75cb196efd13ed66bac8689e84b8b3d892f/larq-0.7.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e6f19c6e4e301022d711b82396d1abb3", "sha256": "59c5a5e1d92512b5d78dbd64197ffbdcb28fc839e4d4d250b159708e4f9a534f" }, "downloads": -1, "filename": "larq-0.7.4.tar.gz", "has_sig": false, "md5_digest": "e6f19c6e4e301022d711b82396d1abb3", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 35169, "upload_time": "2019-10-14T18:30:59", "url": "https://files.pythonhosted.org/packages/bb/94/79256fcd8dfaa9afba1f293b8df4ceb804b9ba5f686d4a9abff86b7cb1b9/larq-0.7.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "57772c7f11aae42afca9128c9e722c47", "sha256": "30901954db26110d63ecc8612407b511fe91bd41a87dbd4050a03178709210af" }, "downloads": -1, "filename": "larq-0.7.4-py3-none-any.whl", "has_sig": false, "md5_digest": "57772c7f11aae42afca9128c9e722c47", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 46519, "upload_time": "2019-10-14T18:30:57", "url": "https://files.pythonhosted.org/packages/3f/26/5d7d6b15a38b9a7df4d66db9b75cb196efd13ed66bac8689e84b8b3d892f/larq-0.7.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e6f19c6e4e301022d711b82396d1abb3", "sha256": "59c5a5e1d92512b5d78dbd64197ffbdcb28fc839e4d4d250b159708e4f9a534f" }, "downloads": -1, "filename": "larq-0.7.4.tar.gz", "has_sig": false, "md5_digest": "e6f19c6e4e301022d711b82396d1abb3", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 35169, "upload_time": "2019-10-14T18:30:59", "url": "https://files.pythonhosted.org/packages/bb/94/79256fcd8dfaa9afba1f293b8df4ceb804b9ba5f686d4a9abff86b7cb1b9/larq-0.7.4.tar.gz" } ] }