google-deepmind / google-deepmind/chex

Assert for either is populated but not both

Open
#393 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
957
Forks
74
Avg merge
21h 10m
Merged PRs (30d)
1

Description

I am trying to convert [these lines of code](https://github.com/google/tf-quant-finance/blob/4c4b57e9808f5b60184d8fd5f7f43aaf5871313b/tf_quant_finance/black_scholes/vanilla_prices.py#L126-L128) to JAX/Chex format. So I essentially want to invert `chex.assert_not_both_none` to get something like `chex.assert_not_both_not_none` meaning that one or the other is populated, but not both. Is there already a way to do that using Chex, so is there already a way to invert existing asserts? Or could this one be added?

Editing to add, what I am looking for is an assert where neither being populated is ok, one being populated is ok, but both being populated raises an assert. Also, if this should be added, then I would be happy to give it a try as my first contribution to Chex.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.