Name | caskade JSON |
Version |
0.5.0
JSON |
| download |
home_page | None |
Summary | Package for building scientific simulators, with dynamic arguments arranged in a directed acyclic graph. |
upload_time | 2024-10-26 18:53:14 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.9 |
license | MIT License Copyright (c) 2024 Connor Stone, PhD Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
keywords |
dag
caskade
differentiable programming
pytorch
scientific python
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# caskade
[![CI](https://github.com/ConnorStoneAstro/caskade/actions/workflows/ci.yml/badge.svg)](https://github.com/ConnorStoneAstro/caskade/actions/workflows/ci.yml)
[![CD](https://github.com/ConnorStoneAstro/caskade/actions/workflows/cd.yml/badge.svg)](https://github.com/ConnorStoneAstro/caskade/actions/workflows/cd.yml)
[![codecov](https://codecov.io/gh/ConnorStoneAstro/caskade/graph/badge.svg?token=7YAEJJZ4GM)](https://codecov.io/gh/ConnorStoneAstro/caskade)
[![PyPI - Version](https://img.shields.io/pypi/v/caskade)](https://pypi.org/project/caskade/)
[![Documentation Status](https://readthedocs.org/projects/caskade/badge/?version=latest)](https://caskade.readthedocs.io/en/latest/?badge=latest)
Build scientific simulators, treating them as a directed acyclic graph. Handles
argument passing for complex nested simulators.
## Install
``` bash
pip install caskade
```
## Usage
Make a `Module` object which may have some `Param`s. Define a `forward` method
using the decorator.
``` python
from caskade import Module, Param, forward
class MySim(Module):
def __init__(self, a, b=None):
super().__init__()
self.a = a
self.b = Param("b", b)
@forward
def myfun(self, x, b=None):
return x + self.a + b
```
We may now create instances of the simulator and pass the dynamic parameters.
``` python
import torch
sim = MySim(1.0)
params = [torch.tensor(2.0)]
print(sim.myfun(3.0, params=params))
```
Which will print `6` by automatically filling `b` with the value from `params`.
### Why do this?
The above example is not very impressive, the real power comes from the fact
that `Module` objects can be nested arbitrarily making a much more complicated
analysis graph. Further, the `Param` objects can be linked or have other complex
relationships. All of the complexity of the nested structure and argument
passing is abstracted away so that at the top one need only pass a list of
tensors for each parameter, a single large 1d tensor, or a dictionary with the
same structure as the graph.
## Documentation
The `caskade` interface has lots of flexibility, check out the
[docs](https://caskade.readthedocs.io) to learn more. For a quick start, jump
right to the [Jupyter notebook
tutorial](https://caskade.readthedocs.io/en/latest/notebooks/BeginnersGuide.html)!
Raw data
{
"_id": null,
"home_page": null,
"name": "caskade",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "DAG, caskade, differentiable programming, pytorch, scientific python",
"author": null,
"author_email": "Connor Stone <connorstone628@gmail.com>, Alexandre Adam <alexandre.adam@mila.quebec>",
"download_url": "https://files.pythonhosted.org/packages/d7/67/2ecb2d89a38540839e7caac54e0fc5be32a5cb2364af6809585fcf27b81c/caskade-0.5.0.tar.gz",
"platform": null,
"description": "# caskade\n\n[![CI](https://github.com/ConnorStoneAstro/caskade/actions/workflows/ci.yml/badge.svg)](https://github.com/ConnorStoneAstro/caskade/actions/workflows/ci.yml)\n[![CD](https://github.com/ConnorStoneAstro/caskade/actions/workflows/cd.yml/badge.svg)](https://github.com/ConnorStoneAstro/caskade/actions/workflows/cd.yml)\n[![codecov](https://codecov.io/gh/ConnorStoneAstro/caskade/graph/badge.svg?token=7YAEJJZ4GM)](https://codecov.io/gh/ConnorStoneAstro/caskade)\n[![PyPI - Version](https://img.shields.io/pypi/v/caskade)](https://pypi.org/project/caskade/)\n[![Documentation Status](https://readthedocs.org/projects/caskade/badge/?version=latest)](https://caskade.readthedocs.io/en/latest/?badge=latest)\n\nBuild scientific simulators, treating them as a directed acyclic graph. Handles\nargument passing for complex nested simulators.\n\n## Install\n\n``` bash\npip install caskade\n```\n\n## Usage\n\nMake a `Module` object which may have some `Param`s. Define a `forward` method\nusing the decorator.\n\n``` python\nfrom caskade import Module, Param, forward\n\nclass MySim(Module):\n def __init__(self, a, b=None):\n super().__init__()\n self.a = a\n self.b = Param(\"b\", b)\n\n @forward\n def myfun(self, x, b=None):\n return x + self.a + b\n```\n\nWe may now create instances of the simulator and pass the dynamic parameters.\n\n``` python\nimport torch\n\nsim = MySim(1.0)\n\nparams = [torch.tensor(2.0)]\n\nprint(sim.myfun(3.0, params=params))\n```\n\nWhich will print `6` by automatically filling `b` with the value from `params`.\n\n### Why do this?\n\nThe above example is not very impressive, the real power comes from the fact\nthat `Module` objects can be nested arbitrarily making a much more complicated\nanalysis graph. Further, the `Param` objects can be linked or have other complex\nrelationships. All of the complexity of the nested structure and argument\npassing is abstracted away so that at the top one need only pass a list of\ntensors for each parameter, a single large 1d tensor, or a dictionary with the\nsame structure as the graph.\n\n## Documentation\n\nThe `caskade` interface has lots of flexibility, check out the\n[docs](https://caskade.readthedocs.io) to learn more. For a quick start, jump\nright to the [Jupyter notebook\ntutorial](https://caskade.readthedocs.io/en/latest/notebooks/BeginnersGuide.html)!",
"bugtrack_url": null,
"license": "MIT License Copyright (c) 2024 Connor Stone, PhD Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
"summary": "Package for building scientific simulators, with dynamic arguments arranged in a directed acyclic graph.",
"version": "0.5.0",
"project_urls": {
"Documentation": "https://github.com/ConnorStoneAstro/caskade",
"Homepage": "https://github.com/ConnorStoneAstro/caskade",
"Issues": "https://github.com/ConnorStoneAstro/caskade/issues",
"Repository": "https://github.com/ConnorStoneAstro/caskade"
},
"split_keywords": [
"dag",
" caskade",
" differentiable programming",
" pytorch",
" scientific python"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "74239ca157ff984243b1bf5733f6a696db31bb3c4c4cb2580dbc4ee412fb0c70",
"md5": "1726c52430a68555ad9b1190ef3ff522",
"sha256": "b8a75decc3240f27d7bd0875efc2a1c6da22462add63976a761c00e1b6f8331e"
},
"downloads": -1,
"filename": "caskade-0.5.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "1726c52430a68555ad9b1190ef3ff522",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 16121,
"upload_time": "2024-10-26T18:53:13",
"upload_time_iso_8601": "2024-10-26T18:53:13.445718Z",
"url": "https://files.pythonhosted.org/packages/74/23/9ca157ff984243b1bf5733f6a696db31bb3c4c4cb2580dbc4ee412fb0c70/caskade-0.5.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "d7672ecb2d89a38540839e7caac54e0fc5be32a5cb2364af6809585fcf27b81c",
"md5": "14ef42b484e2ea22a3752780a4b703ab",
"sha256": "bbfbeeb8c7a05fd73f7e3767567005b2b5cb13330bd07b7d050d3447d6bb4018"
},
"downloads": -1,
"filename": "caskade-0.5.0.tar.gz",
"has_sig": false,
"md5_digest": "14ef42b484e2ea22a3752780a4b703ab",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 1985347,
"upload_time": "2024-10-26T18:53:14",
"upload_time_iso_8601": "2024-10-26T18:53:14.785251Z",
"url": "https://files.pythonhosted.org/packages/d7/67/2ecb2d89a38540839e7caac54e0fc5be32a5cb2364af6809585fcf27b81c/caskade-0.5.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-26 18:53:14",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ConnorStoneAstro",
"github_project": "caskade",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "caskade"
}