Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix deepcopy bug in autograd #1751

Merged
merged 1 commit into from
Jun 10, 2024
Merged

Conversation

tylerflex
Copy link
Collaborator

Long story short, seems when we deepcopy() a td.DataArray containing autograd tracers, bad things can happen:

  1. The run_async tracing ignores anything but the last SimulationData in the batch.
  2. The gradient information can get corrupted..

This PR does two things:

  1. Changes default behavior of deepcopy(td.DataArray) to do a shallow copy if there are tracers present.
  2. Properly passes the deep kwarg in Tidy3dBaseModel.copy() and related methods.

@tylerflex tylerflex added 2.7 will go into version 2.7.* .0 To be released in the official release of x.y e.g. x.y.0 blocking This version can't be released until this PR is merged labels Jun 8, 2024
Copy link
Contributor

@yaugenst-flex yaugenst-flex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing...

@tylerflex tylerflex force-pushed the tyler/autograd_/fix_deepcopy_bug branch from 837e96f to e7161a9 Compare June 8, 2024 19:39
@tylerflex tylerflex merged commit 7affd9b into develop Jun 10, 2024
16 checks passed
@tylerflex tylerflex deleted the tyler/autograd_/fix_deepcopy_bug branch June 10, 2024 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.7 will go into version 2.7.* blocking This version can't be released until this PR is merged .0 To be released in the official release of x.y e.g. x.y.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants