Skip to content

fix z-coeffs skip when 0 for torch#479

Open
edudc wants to merge 1 commit into
DeepTrackAI:gv/final/features2from
edudc:z-coeffs-fix
Open

fix z-coeffs skip when 0 for torch#479
edudc wants to merge 1 commit into
DeepTrackAI:gv/final/features2from
edudc:z-coeffs-fix

Conversation

@edudc
Copy link
Copy Markdown

@edudc edudc commented May 8, 2026

This fixes torch autograd for trainable Zernike coefficients initialized at zero.
The current Zernike loop skips any coefficient where coefficient == 0. For a torch tensor/Parameter it removes the coefficient from the computation graph.

Proposed change:

  if (n - abs(m)) % 2:
      continue
  if not (TORCH_AVAILABLE and torch.is_tensor(coefficient)) and coefficient == 0:
      continue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants