Conversation
jeffcarp
reviewed
Mar 18, 2025
src/metrax/base_metrics_test.py
Outdated
| y = jnp.array([2.0, -4.0, 0.0, 0.0]) | ||
| expected = jnp.array([-5.0, -5.0, 0.0, 0.0]) | ||
| result = base_metrics.divide_no_nan(x, y) | ||
| self.assertTrue(jnp.array_equal(result, expected)) |
Collaborator
There was a problem hiding this comment.
(Optional) I think all the above tests can be wrapped up in one method using @parameterized.named_parameters as below
Collaborator
Author
There was a problem hiding this comment.
modified to @parameterized.named_parameters. Now the inputs were modified to become np array because of this error:
Inside google3, JAX functions cannot be called before InitGoogle() runs, which typically happens inside the call to absl.app.run() inside your program's main() function. Typically this means that you are attempting to manipulate JAX arrays from the top level of your Python program. You must defer such computations until after main() by putting them inside a function, or use classic NumPy arrays instead.
| @@ -0,0 +1,60 @@ | |||
| # Copyright 2024 Google LLC | |||
Collaborator
There was a problem hiding this comment.
How would you feel about calling this base.py (since it's not just metrics)
Collaborator
Author
There was a problem hiding this comment.
modified to base.py
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.