-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add flax serialization support, bump version
- Loading branch information
Showing
5 changed files
with
66 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,18 +5,19 @@ | |
|
||
setup( | ||
name="jaxlie", | ||
version="0.0.2", | ||
version="0.0.3", | ||
description="Matrix Lie groups in Jax", | ||
long_description=long_description, | ||
long_description_content_type="text/markdown", | ||
url="http://github.com/brentyi/jaxlie", | ||
author="brentyi", | ||
author_email="[email protected]", | ||
license="MIT", | ||
packages=find_packages(exclude=["examples", "tests"]), | ||
packages=find_packages(), | ||
package_data={"liejax": ["py.typed"]}, | ||
python_requires=">=3.6", | ||
install_requires=[ | ||
"flax", | ||
"jax", | ||
"jaxlib", | ||
"numpy", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
"""Tests for transform serialization, for things like saving calibrated transforms to | ||
disk. | ||
""" | ||
|
||
from typing import Type | ||
|
||
import flax | ||
from utils import assert_transforms_close, general_group_test, sample_transform | ||
|
||
import jaxlie | ||
|
||
|
||
@general_group_test | ||
def test_serialization_state_dict_bijective( | ||
Group: Type[jaxlie.MatrixLieGroup], _random_module | ||
): | ||
"""Check bijectivity of state dict representation conversations.""" | ||
T = sample_transform(Group) | ||
T_recovered = flax.serialization.from_state_dict( | ||
T, flax.serialization.to_state_dict(T) | ||
) | ||
assert_transforms_close(T, T_recovered) | ||
|
||
|
||
@general_group_test | ||
def test_serialization_bytes_bijective( | ||
Group: Type[jaxlie.MatrixLieGroup], _random_module | ||
): | ||
"""Check bijectivity of byte representation conversations.""" | ||
T = sample_transform(Group) | ||
T_recovered = flax.serialization.from_bytes(T, flax.serialization.to_bytes(T)) | ||
assert_transforms_close(T, T_recovered) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters