Skip to content

Commit

Permalink
Merge pull request #60 from invrs-io/fix
Browse files Browse the repository at this point in the history
Serialize fmmax types
  • Loading branch information
mfschubert authored Dec 1, 2023
2 parents 1140f6c + ee53363 commit 07c8ce1
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tool.bumpversion]
current_version = "v0.3.0"
current_version = "v0.3.1"
commit = true
commit_args = "--no-verify"
tag = true
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# invrs-gym - A collection of inverse design challenges
`v0.3.0`
`v0.3.1`

## Overview
The `invrs_gym` package is an open-source gym containing a diverse set of photonic design challenges, which are relevant for a wide range of applications such as AR/VR, optical networking, LIDAR, and others.
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[project]

name = "invrs_gym"
version = "v0.3.0"
version = "v0.3.1"
description = "A collection of inverse design challenges"
keywords = ["topology", "optimization", "jax", "inverse design"]
readme = "README.md"
Expand Down
2 changes: 1 addition & 1 deletion src/invrs_gym/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Copyright (c) 2023 The INVRS-IO authors.
"""

__version__ = "v0.3.0"
__version__ = "v0.3.1"
__author__ = "Martin F. Schubert <[email protected]>"

from invrs_gym import challenges as challenges
Expand Down
8 changes: 7 additions & 1 deletion src/invrs_gym/challenges/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
import abc
from typing import Any, Callable, Dict, Tuple

import fmmax
import jax
import jax.numpy as jnp
from totypes import types
from totypes import json_utils, types

AuxDict = Dict[str, Any]
PyTree = Any
Expand Down Expand Up @@ -74,3 +75,8 @@ def distance_to_target(self, response: Any) -> jnp.ndarray:
@abc.abstractmethod
def metrics(self, response: Any, params: PyTree, aux: AuxDict) -> AuxDict:
"""Compute metrics for a component response and associated quantities."""


# Several challenges use the `fmmax` simulator, and contain `fmmax` custom objects in
# their responses. Ensure these are serializable by registering with totypes.
json_utils.register_custom_type(fmmax.basis.Expansion)

0 comments on commit 07c8ce1

Please sign in to comment.