-
Notifications
You must be signed in to change notification settings - Fork 616
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
Fixes bugs in optimizer docstrings #1053
Conversation
Hello. You may have forgotten to update the changelog!
|
tuple[list [array], float]: the new variable values :math:`x^{(t+1)}` and the objective | ||
function output prior to the step. | ||
If single arg is provided, list [array] is replaced by array. |
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.
Continuation lines in Returns:
should never be indented; if they are, sphinx will treat them as a glossary entry and bold the first line.
@@ -106,8 +106,8 @@ def step(self, objective_fn, *args, grad_fn=None, **kwargs): | |||
|
|||
@staticmethod | |||
def compute_grad(objective_fn, args, kwargs, grad_fn=None): | |||
r"""Compute gradient of the objective_fn at the point x and return it along with the |
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.
The docstring conventions discourage the use of variable names in the first line/summary line of the docstring. Hence replacing objective_fn
with 'objective function'.
Codecov Report
@@ Coverage Diff @@
## master #1053 +/- ##
=======================================
Coverage 97.75% 97.75%
=======================================
Files 153 153
Lines 11514 11514
=======================================
Hits 11255 11255
Misses 259 259
Continue to review full report at Codecov.
|
Context:
Description of the Change:
Removes rendering bugs in the
Returns:
statement by removing indentation in continuation lines. While theArgs:
section requires continuation lines be indented since there might be multiple arguments, there is only ever a single return, and so the return is never indented.In Allowing more flexible cost functions for optimizers #959, most of the optimizers were updated to remove restrictions on cost function signatures. As a result, the
x
argument was changed to*args
to be more general. Some strayx
mentions in the docstrings were removed.Benefits: Docstrings render correctly.
Possible Drawbacks:
I noticed while working on this that the
QNGOptimizer
is the one optimizer that continues to only accept cost functions with a single argument. This was intentional in #959, as at the time themetric_tensor
method did not allow multiple QNode arguments.However, the new
qml.metric_tensor
function that was added in #1014 removes this restriction, so we are now unblocked from also updating theQNGOptimizer
.Related GitHub Issues: n/a