-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make Zimtohrli python version easier to jit.
Changes: * Make the `Cam` class static from the point of view of jax. To allow jitting, the _hz_freqs array should not be a jax array, because depending on the values of the hyperparameters, the array shape should be different, making it impossible to jit. When attempting to jit the previous version of the code, creating that array under a jit context would fail. -> This requires adjusting the test tolerance from 1e-7 to 1e-5. The equivalent test in c++ uses 1e-2. * For `Channels` and `Signals` class, mark which fields are data_fields vs. meta_fields (that can be used for JIT cache) * Remove default arguments that are jnp.array by np.array * Make the `Masking` class static and remove the `jit` over `non_masked_energy` `self` being the first argument makes it unsuitable for jitting. * Added a test to check that: - Jitting works - Results are the same with/without jitting.
- Loading branch information
Showing
6 changed files
with
46 additions
and
24 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
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