-
Notifications
You must be signed in to change notification settings - Fork 47
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
Fix return_dict
when an AmiciObjective
is inside AggregatedObjective
#1424
Changes from 2 commits
5860c0f
27779ab
1ff18a9
5a592e1
0a4cc11
8b21c42
b9ec235
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,8 +45,13 @@ class ObjectiveBase(ABC): | |
pre_post_processor: | ||
Preprocess input values to and postprocess output values from | ||
__call__. Configured in `update_from_problem()`. | ||
share_return_dict: | ||
Whether the objective uses `return_dict` in its `call_unprocessed` | ||
method. | ||
""" | ||
|
||
share_return_dict: bool = False | ||
|
||
def __init__( | ||
self, | ||
x_names: Optional[Sequence[str]] = None, | ||
|
@@ -178,6 +183,8 @@ def __call__( | |
x_full = self.pre_post_processor.preprocess(x=x) | ||
|
||
# compute result | ||
if self.share_return_dict: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why is this necessary? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Otherwise there might be some argument error, because |
||
kwargs["return_dict"] = return_dict | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It cannot be, since |
||
result = self.call_unprocessed( | ||
x=x_full, sensi_orders=sensi_orders, mode=mode, **kwargs | ||
) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be made clear in the documentation that amici_reporting takes precedence over return_dict imo.