parent_deriv_vars will evaluate to True if it's equal to ((), ()), so the check should be if parent_deriv_vars[0] or parent_deriv_vars[1] for input/output respectively