Skip to content

Commit c061859

Browse files
committed
support automatic differentiation natively in tidy3d through autograd
1 parent b54df57 commit c061859

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+5235
-1123
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Autograd Bug Report
3+
about: Create a report to help us improve our autograd feature
4+
title: 'Autograd Bug'
5+
labels: 'autograd'
6+
assignees: 'tylerflex'
7+
8+
---
9+
10+
**Description**
11+
Please paste the error message displayed in your warning when running `tidy3d.web.run()` or `tidy3d.web.run_async()`
12+
13+
**Simulation Setup**
14+
15+
Please describe your simulation setup as specifically as you can, including code snippets or uploading the `simulation.to_file('sim.json')` file.
16+
17+
Also please include what options were passed to the `web` function.
18+
19+
**Other information**
20+
Anything else you'd like to add to help us look into it?

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ _autosummary
112112

113113
# Test and temporary files
114114
tests/tmp/*
115-
tests/data/invdes_history.pkl
115+
tests/data/invdes_history.*
116116

117117
# Translations
118118
*.mo
@@ -134,3 +134,6 @@ htmlcov/
134134
# Specific file and folder exclusions
135135
.idea
136136
.vscode
137+
138+
# cProfile output
139+
*.prof

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66
## [Unreleased]
77

88
### Added
9+
- Automatic differentiation supported natively in Tidy3D components, and through the `web.run()` and `web.run_async()` functions through `autograd`.
910
- A batch of `ModeSolver` objects can be run concurrently using `tidy3d.plugins.mode.web.run_batch()`
1011
- `RectangularWaveguide.plot_field` optionally draws geometry edges over fields.
1112
- `RectangularWaveguide` supports layered cladding above and below core.

docs/api/plugins/autograd.rst

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
.. currentmodule:: tidy3d
2+
3+
Automatic Differentiation with Autograd
4+
---------------------------------------
5+
6+
.. toctree::
7+
8+
../../../tidy3d/plugins/autograd/README
9+
10+
.. autosummary::
11+
:toctree: ../_autosummary/
12+
:template: module.rst
13+
14+
tidy3d.plugins.autograd.functions.threshold
15+
tidy3d.plugins.autograd.functions.rescale
16+
tidy3d.plugins.autograd.functions.morphological_gradient_external
17+
tidy3d.plugins.autograd.functions.morphological_gradient_internal
18+
tidy3d.plugins.autograd.functions.morphological_gradient
19+
tidy3d.plugins.autograd.functions.grey_closing
20+
tidy3d.plugins.autograd.functions.grey_opening
21+
tidy3d.plugins.autograd.functions.grey_erosion
22+
tidy3d.plugins.autograd.functions.grey_dilation
23+
tidy3d.plugins.autograd.functions.pad
24+
tidy3d.plugins.autograd.functions.convolve
25+
26+
tidy3d.plugins.autograd.primitives.gaussian_filter
27+
28+
tidy3d.plugins.autograd.types.PaddingType
29+
tidy3d.plugins.autograd.types.KernelType
30+
31+
tidy3d.plugins.autograd.invdes.get_kernel_size_px
32+
tidy3d.plugins.autograd.invdes.grey_indicator
33+
tidy3d.plugins.autograd.invdes.make_circular_filter
34+
tidy3d.plugins.autograd.invdes.make_conic_filter
35+
tidy3d.plugins.autograd.invdes.make_curvature_penalty
36+
tidy3d.plugins.autograd.invdes.make_erosion_dilation_penalty
37+
tidy3d.plugins.autograd.invdes.make_filter
38+
tidy3d.plugins.autograd.invdes.make_filter_and_project
39+
tidy3d.plugins.autograd.invdes.ramp_projection
40+
tidy3d.plugins.autograd.invdes.tanh_projection

docs/api/plugins/index.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Plugins
99
polyslab
1010
smatrix
1111
resonance
12+
autograd
1213
adjoint
1314
waveguide
1415
design
@@ -20,6 +21,7 @@ Plugins
2021
.. include:: /api/plugins/polyslab.rst
2122
.. include:: /api/plugins/smatrix.rst
2223
.. include:: /api/plugins/resonance.rst
24+
.. include:: /api/plugins/autograd.rst
2325
.. include:: /api/plugins/adjoint.rst
2426
.. include:: /api/plugins/waveguide.rst
2527
.. include:: /api/plugins/design.rst

poetry.lock

Lines changed: 486 additions & 477 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ pydantic = "^2.0"
3636
PyYAML = "*"
3737
dask = "*"
3838
toml = "*"
39+
autograd = "1.6.2"
40+
3941
### NOT CORE
4042
scipy = "*"
4143
boto3 = "^1.28.0"

results.prof

-232 KB
Binary file not shown.

0 commit comments

Comments
 (0)