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
perf(autograd): optimize grey_dilation with striding
The previous implementation of `grey_dilation` was based on convolution, which was slow for both the forward and backward passes.
This commit replaces it with a high-performance implementation that uses NumPy's `as_strided` to create sliding window views of the input array. This avoids redundant computations and memory allocations, leading to significant speedups.
The VJP (gradient) for the primitive is also updated to use the same striding technique, ensuring the backward pass is also much faster.
Benchmarks show speedups of 10-100x depending on the array and kernel size.
Copy file name to clipboardExpand all lines: CHANGELOG.md
+3-2Lines changed: 3 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
8
8
## [Unreleased]
9
9
10
+
### Changed
11
+
- Significantly improved performance of the `tidy3d.plugins.autograd.grey_dilation` morphological operation and its gradient calculation. The new implementation is orders of magnitude faster, especially for large arrays and kernel sizes.
12
+
10
13
### Fixed
11
14
- Arrow lengths are now scaled consistently in the X and Y directions,
12
15
and their lengths no longer exceed the height of the plot window.
@@ -97,8 +100,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
97
100
98
101
### Fixed
99
102
- Fixed `reverse` property of `td.Scene.plot_structures_property()` to also reverse the colorbar.
100
-
101
-
### Fixed
102
103
- Fixed bug in surface gradient computation where fields, instead of gradients, were being summed in frequency.
0 commit comments