Skip to content

Improve handling of params argument in Gradient.convert #5553

@Cryoris

Description

@Cryoris

What is the expected enhancement?

The convert method of the gradients takes a params argument specifying for which parameters the gradient should be computed. The error messages and supported input types of that argument vary between Gradient, NaturalGradient, QFI etc. For instance, Gradient.convert supports ParameterVectors but for the others the parameter vector must explicitly be unpacked in a list.

Also the error messages if the argument is missing can be improved. E.g. not passing the argument for the QFI merely raises

KeyError: None

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions