You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tidy3d/plugins/autograd/README.md
+6-13Lines changed: 6 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,10 +11,9 @@ This functionality was previously available using the `adjoint` plugin, which us
11
11
3. Because we inherited these classes from their `tidy3d` components, for technical reasons, we needed to separate the `jax`-traced fields from the regular fields.
12
12
For example, `JaxSimulation.input_structures` and `.output_monitors` were needed.
13
13
14
-
All of these limitations (among others) motivated us to come up with a new approach to automatic differentiation, which was introduced as an experimental feature in `2.7`.
15
-
The `adjoint` plugin will continue to be supported indefinitely, but no new features will be developed for it.
16
-
We also believe the new approach offers a far better user experience, so we encourage users to switch whenever is convenient.
17
-
This guide will give some instructions on how to do so.
14
+
All of these limitations (among others) motivated us to come up with a new approach to automatic differentiation, which was introduced as an experimental feature in `2.7` and is now the default.
15
+
The previous JAX-based `adjoint` plugin has been removed in favor of this built-in workflow.
16
+
This guide will give some instructions on how to migrate existing code.
18
17
19
18
## New implementation using `autograd`
20
19
@@ -89,18 +88,12 @@ Additionally, `autograd` has a `grad_with_aux` function that can be used to comp
89
88
90
89
Otherwise, `jax` and `autograd` are very similar to each other in practice.
91
90
92
-
### Migrating from `adjoint` plugin
91
+
### Migrating from the deprecated `adjoint` plugin
93
92
94
93
Converting code from the `adjoint` plugin to the native autograd support is straightforward.
95
94
96
-
Instead of importing classes from the `tda` namespace, with names like `tda.Jax_`, we can just use regular `td.` classes.
97
-
98
-
```py
99
-
import tidy3d.plugins.adjoint as tda
100
-
tda.JaxStructure(...)
101
-
```
102
-
103
-
becomes
95
+
Instead of importing classes from the old `tidy3d.plugins.adjoint` namespace (for example `tda.JaxStructure`),
96
+
you can use the regular `tidy3d` classes directly:
Copy file name to clipboardExpand all lines: tidy3d/plugins/invdes/README.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@
4
4
5
5
This describes the "Inverse Design" (`invdes`) plugin of Tidy3D.
6
6
7
-
The goal of `invdes` is to provide a simpler interface for setting up most practical inverse design problems. It wraps the lower-level `adjoint` plugin of Tidy3D to perform the gradient calculations, but allows the user to focus on the important aspects of their design without getting into the details of `autograd`.
7
+
The goal of `invdes` is to provide a simpler interface for setting up most practical inverse design problems. It leverages Tidy3D's native autograd-based adjoint infrastructure to perform the gradient calculations, while allowing the user to focus on the important aspects of their design without getting into low-level workflow details.
8
8
9
9
In this notebook, we'll give a simple demo showing the inverse design of a 1 -> 3 splitter using the inverse design plugin.
10
10
@@ -97,7 +97,7 @@ Next we want to define the base `td.Simulation` that contains the static portion
97
97
98
98
For this, we will make a bunch of regular `tidy3d` components (excluding the design region) and put them into a `td.Simulation`.
99
99
100
-
> Note: we don't need to use `adjoint` components, such as `td.Simulation` in the `invdes`plugin. These components are created behind the scenes by the higher level wrappers that we define here.
100
+
> Note: there is no need to use any special autograd-specific component classes in user code; the plugin builds the differentiable structures internally from the standard `td.*` objects defined here.
101
101
102
102
```py
103
103
@@ -285,7 +285,7 @@ design = tdi.InverseDesign(
285
285
output_monitor_names=[mnt.name for mnt in monitors_out],
286
286
)
287
287
```
288
-
> Note: the `output_monitor_names` field is used to specify which monitors to use in the objective function. If they are not supplied, `invdes` will automatically include all compatible monitors, but at times these can raise warnings in the `adjoint` plugin, so it can be nice to specify.
288
+
> Note: the `output_monitor_names` field is used to specify which monitors to use in the objective function. If they are not supplied, `invdes` will automatically include all compatible monitors, but at times these can raise warnings if the differentiable workflow cannot trace certain monitor types, so it can be nice to specify.
289
289
290
290
The `InverseDesign` object can be exported to a `td.Simulation` given some parameters using the `to_simulation(params)` method.
0 commit comments