Skip to content

Commit

Permalink
Merge pull request #13 from invrs-io/loss_fix
Browse files Browse the repository at this point in the history
Avoid nan loss
  • Loading branch information
mfschubert authored Sep 28, 2023
2 parents 5b83a62 + db2c234 commit 8cb8356
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/invrs_gym/challenge/diffract/metagrating_challenge.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def loss(self, response: common.GratingResponse) -> jnp.ndarray:
expansion=response.expansion,
order=self.transmission_order,
)
return jnp.mean(jnp.sqrt(1 - transmission_efficiency))
return jnp.mean(jnp.sqrt(jnp.abs(1 - transmission_efficiency)))

def metrics(
self,
Expand Down

0 comments on commit 8cb8356

Please sign in to comment.