Skip to content

Commit bf1645c

Browse files
committed
fix polyslab edge gradient assignment
1 parent 27720fc commit bf1645c

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2424
- Bug when differentiating with respect to `Cylinder.center`.
2525
- `xarray` 2024.10.0 compatibility for autograd.
2626
- Some failing examples in the expressions plugin documentation.
27-
27+
- Inaccuracy in transforming gradients from edge to `PolySlab.vertices`.
2828

2929
## [2.7.6] - 2024-10-30
3030

tidy3d/components/geometry/polyslab.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1448,7 +1448,7 @@ def compute_derivative_vertices(self, derivative_info: DerivativeInfo) -> Traced
14481448

14491449
vjps_edges_in_plane = vjps_edges.values.reshape((num_vertices, 1)) * normal_vectors_in_plane
14501450

1451-
vjps_vertices = vjps_edges_in_plane + np.roll(vjps_edges_in_plane, axis=0, shift=-1)
1451+
vjps_vertices = vjps_edges_in_plane + np.roll(vjps_edges_in_plane, axis=0, shift=1)
14521452
vjps_vertices /= 2.0 # each vertex is effected only 1/2 by each edge
14531453

14541454
# sign change if counter clockwise, because normal direction is flipped

0 commit comments

Comments
 (0)