Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to check shapes with wildcards #5

Merged
merged 1 commit into from Oct 6, 2020

Conversation

KristianHolsheimer
Copy link
Contributor

I often find myself writing the following sort of thing:

chex.assert_rank(x, 2)
x.shape[1] == num_actions, "some custom message ..."

It would be nice to be able to simply check the shape with a wildcard, i.e.

chex.assert_shape(x, (None, num_actions))

What do you think?

@googlebot googlebot added the cla: yes copybara label for automatic import label Oct 5, 2020
@KristianHolsheimer
Copy link
Contributor Author

Also, I tried to run the tests locally with

pytest .

which results in failures saying Trying to access flag --chex_n_cpu_devices before flags were parsed.

What do you use to run your tests?

@hbq1
Copy link
Collaborator

hbq1 commented Oct 6, 2020

Hey Kristian, this is a great idea 👍 Thanks a lot for the contribution!

You can run tests as simple as python <tests_src.py>. To run all tests at once you can execute e.g.

for test in `ls chex/_src/*_test.py`; do if ! `python $test`; then break; fi; done

if you work in bash.
That to be said, some tests may require additional dependencies, e.g. tree or dm-tree.

@hbq1 hbq1 self-assigned this Oct 6, 2020
@copybara-service copybara-service bot merged commit 54d66a5 into google-deepmind:master Oct 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes copybara label for automatic import
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants