{ "info": { "author": "Stephan Seitz", "author_email": "stephan.seitz@fau.de", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Programming Language :: Python" ], "description": ".. image:: https://badge.fury.io/py/pystencils-autodiff.svg\n :target: https://badge.fury.io/py/pystencils-autodiff\n :alt: PyPI version\n\n.. image:: https://readthedocs.org/projects/pystencils-autodiff/badge/?version=latest\n :target: https://pystencils-autodiff.readthedocs.io/en/latest/?badge=latest\n :alt: Documentation Status===================\n\n.. image:: https://i10git.cs.fau.de/pycodegen/pystencils_autodiff/badges/master/pipeline.svg \n :target: https://i10git.cs.fau.de/pycodegen/pystencils_autodiff\n :alt: Gitlab CI\n\n.. image:: https://travis-ci.org/theHamsta/pystencils_autodiff.svg?branch=master\n :target: https://travis-ci.org/theHamsta/pystencils_autodiff\n\n.. image:: https://codecov.io/gh/theHamsta/pystencils_autodiff/branch/master/graph/badge.svg\n :target: https://codecov.io/gh/theHamsta/pystencils_autodiff\n\npystencils_autodiff\n===================\n\nThis repo adds automatic differentiation to `pystencils `_.\n\nInstallation\n------------\n\nInstall via pip:\n\n.. code-block:: bash\n\n pip install pystencils-autodiff\n\nor if you downloaded this `repository `_ using:\n\n.. code-block:: bash\n\n pip install -e .\n\nThen, you can access the submodule `pystencils.autodiff`.\n\n.. code-block:: python\n\n import pystencils.autodiff\n\nUsage\n-----\n\nCreate a `pystencils.AssignmentCollection` with pystencils:\n\n.. code-block:: python\n\n import sympy\n import pystencils\n\n z, y, x = pystencils.fields(\"z, y, x: [20,30]\")\n\n forward_assignments = pystencils.AssignmentCollection({\n z[0, 0]: x[0, 0] * sympy.log(x[0, 0] * y[0, 0])\n })\n\n print(forward_assignments)\n\n\n.. code-block:: python\n\n Subexpressions:\n Main Assignments:\n z[0,0] \u2190 x_C*log(x_C*y_C)\n \nYou can then obtain the corresponding backward assignments:\n\n.. code-block:: python\n\n from pystencils.autodiff import AutoDiffOp, create_backward_assignments\n backward_assignments = create_backward_assignments(forward_assignments)\n\n print(backward_assignments)\n\nYou can see the derivatives with respective to the two inputs multiplied by the gradient `diffz_C` of the output `z_C`.\n\n.. code-block:: python\n\n Subexpressions:\n Main Assignments:\n \\hat{x}[0,0] \u2190 diffz_C*(log(x_C*y_C) + 1)\n \\hat{y}[0,0] \u2190 diffz_C*x_C/y_C\n\nYou can also use the class `AutoDiffOp` to obtain both the assignments (if you are curious) and auto-differentiable operations for Tensorflow...\n\n.. code-block:: python\n\n op = AutoDiffOp(forward_assignments)\n backward_assignments = op.backward_assignments \n\n x_tensor = pystencils.autodiff.tf_variable_from_field(x)\n y_tensor = pystencils.autodiff.tf_variable_from_field(y)\n tensorflow_op = op.create_tensorflow_op({x: x_tensor, y: y_tensor}, backend='tensorflow')\n\n... or Torch:\n\n.. code-block:: python\n\n x_tensor = pystencils.autodiff.torch_tensor_from_field(x, cuda=False, requires_grad=True)\n y_tensor = pystencils.autodiff.torch_tensor_from_field(y, cuda=False, requires_grad=True)\n\n z_tensor = op.create_tensorflow_op({x: x_tensor, y: y_tensor}, backend='torch')", "description_content_type": "text/x-rst; charset=UTF-8", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/theHamsta/pystencils_autodiff", "keywords": "", "license": "GPLv3", "maintainer": "", "maintainer_email": "", "name": "pystencils-autodiff", "package_url": "https://pypi.org/project/pystencils-autodiff/", "platform": "any", "project_url": "https://pypi.org/project/pystencils-autodiff/", "project_urls": { "Documentation": "https://pystencils-autodiff.readthedocs.io/en/latest/", "Homepage": "https://github.com/theHamsta/pystencils_autodiff" }, "release_url": "https://pypi.org/project/pystencils-autodiff/0.2.2/", "requires_dist": null, "requires_python": "", "summary": "Automatic differentiation and generation of Torch/Tensorflow operations with pystencils (https://i10git.cs.fau.de/pycodegen/pystencils)", "version": "0.2.2" }, "last_serial": 5822105, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "3058a19529dfbdfcead31197d01ca7b5", "sha256": "483dd912c54a6d33a66f6bf8c393ca67c56afcbf173411c83336f85eefe7ab69" }, "downloads": -1, "filename": "pystencils_autodiff-0.1.0.tar.gz", "has_sig": false, "md5_digest": "3058a19529dfbdfcead31197d01ca7b5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 34409, "upload_time": "2019-08-07T14:58:43", "url": "https://files.pythonhosted.org/packages/12/cd/f3ee869e8367e909764310b443c037965d09bc113db2072ae8a4aa29a4b0/pystencils_autodiff-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "0314d5822775d8be0f3e8273cfa80e8b", "sha256": "0de2d36e7a48d07b729f640df9b11bfd0da980380b4c152fb3ca39d2de51fa1b" }, "downloads": -1, "filename": "pystencils_autodiff-0.1.1.tar.gz", "has_sig": false, "md5_digest": "0314d5822775d8be0f3e8273cfa80e8b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 34611, "upload_time": "2019-08-07T23:23:30", "url": "https://files.pythonhosted.org/packages/99/4f/287b384f3b3fe7d0708653e15dccd4e0517a4c9a3a1551d9218fc408436d/pystencils_autodiff-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "f7537a39f39124abc89fd00b578eb169", "sha256": "101d431c750e44de3499cb7e6affe08b22c3adf520cde28bc1348bf25e8f883a" }, "downloads": -1, "filename": "pystencils_autodiff-0.1.2.tar.gz", "has_sig": false, "md5_digest": "f7537a39f39124abc89fd00b578eb169", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 34669, "upload_time": "2019-08-07T23:35:24", "url": "https://files.pythonhosted.org/packages/97/0a/dfb3cca5e437e26355f16f157eaf479c5f9f24d6e70be50fb90ef209857b/pystencils_autodiff-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "6f737fe6f8edb120add4cac87801ac1f", "sha256": "800e334adb85f8c2936389e1b5e587df02f0ad7411f060c1b7ea95677ec98e59" }, "downloads": -1, "filename": "pystencils_autodiff-0.1.3.tar.gz", "has_sig": false, "md5_digest": "6f737fe6f8edb120add4cac87801ac1f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 36098, "upload_time": "2019-08-08T02:37:44", "url": "https://files.pythonhosted.org/packages/a3/6e/1f0e713ccd52ed4310c28f5e3828edb97c21b331ea3c01712e62ac2ee5b2/pystencils_autodiff-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "d312e5d84a9fdd3f6e9992ce5a31c9af", "sha256": "9cc9cfad80b60d0cf3b8dd0f665dc7429bff3de4984ab8e74e6e6df240ca51ff" }, "downloads": -1, "filename": "pystencils_autodiff-0.1.4.tar.gz", "has_sig": false, "md5_digest": "d312e5d84a9fdd3f6e9992ce5a31c9af", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 35941, "upload_time": "2019-09-03T09:25:25", "url": "https://files.pythonhosted.org/packages/6d/e0/f1d2ea4428c801beb94505093d348d1615e7f9de10f9e617d9126c082839/pystencils_autodiff-0.1.4.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "0a98de4699e42b8a378065cd2f7646d9", "sha256": "55c1fcf972b9b48c7b551b39cd845662722656a94925ad06084282da4161fd57" }, "downloads": -1, "filename": "pystencils_autodiff-0.2.0.tar.gz", "has_sig": false, "md5_digest": "0a98de4699e42b8a378065cd2f7646d9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 44427, "upload_time": "2019-09-12T18:09:17", "url": "https://files.pythonhosted.org/packages/72/d9/d62f932c68d451d3c4e505a30a7a523f5f51d7f280a3993a16e55b3b3827/pystencils_autodiff-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "8e4b080996282c5b6444acfdfcc81bb8", "sha256": "cf6939b2dbdbc306034cf01e1ec51c00b4251195547e16997fb2a29d5cba5def" }, "downloads": -1, "filename": "pystencils_autodiff-0.2.1.tar.gz", "has_sig": false, "md5_digest": "8e4b080996282c5b6444acfdfcc81bb8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 44429, "upload_time": "2019-09-12T18:43:24", "url": "https://files.pythonhosted.org/packages/59/ca/cb046ea4e3f3daf5b2c46a63e02ca13ef3cced921fc8e2d8c331b525fa18/pystencils_autodiff-0.2.1.tar.gz" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "d07bcd5aacd14b140aa26ddb65e38ad5", "sha256": "35bd9b04b9dfa36292add50aae5a3064ca71171a4051698359b0a9fd34b8d9a7" }, "downloads": -1, "filename": "pystencils_autodiff-0.2.2.tar.gz", "has_sig": false, "md5_digest": "d07bcd5aacd14b140aa26ddb65e38ad5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 44684, "upload_time": "2019-09-12T19:19:46", "url": "https://files.pythonhosted.org/packages/17/7b/c78b32f312309259f61030315e2688d5e2a541950ad79c600b0f6ba44534/pystencils_autodiff-0.2.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d07bcd5aacd14b140aa26ddb65e38ad5", "sha256": "35bd9b04b9dfa36292add50aae5a3064ca71171a4051698359b0a9fd34b8d9a7" }, "downloads": -1, "filename": "pystencils_autodiff-0.2.2.tar.gz", "has_sig": false, "md5_digest": "d07bcd5aacd14b140aa26ddb65e38ad5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 44684, "upload_time": "2019-09-12T19:19:46", "url": "https://files.pythonhosted.org/packages/17/7b/c78b32f312309259f61030315e2688d5e2a541950ad79c600b0f6ba44534/pystencils_autodiff-0.2.2.tar.gz" } ] }