Types of changes
Tweaked the code for get_backend so as to ignore None entries
Motivation and context / Related issue
This is a convenience addition for optional arguments:
def f(a, b=None): nx = get_backend(a, b)
will be nicer that
def f(a,b=None): if b is None: nx = get_backend(a) else: nx = get_backend(a, b)
especially in the case where there are a lot of optional arrays, where the amount of required if statements is combinatorial.
How has this been tested (if it applies)
Added a test in test/test_backend.py. Ran and passed the test workflow.
PR checklist
- I have read the CONTRIBUTING document.
- The documentation is up-to-date with the changes I made (check build artifacts).
- [] All tests passed, and additional code has been covered with new tests.
- I have added the PR and Issue fix to the RELEASES.md file.