Skip to content

Commit

Permalink
Avoid nan loss
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Schubert authored and Martin Schubert committed Sep 28, 2023
1 parent 5b83a62 commit db2c234
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 db2c234

Please sign in to comment.