Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.
This repository was archived by the owner on Jan 12, 2024. It is now read-only.

Improve handling of invalid models in ApplySequentialClassifier #268

Open
@tcNickolas

Description

@tcNickolas

Describe the bug
Passing an invalid model to ApplySequentialClassifier can causes unexpected and inconsistent behaviors:

  • If the index of the target qubit or one of the control qubits used in the ControlledRotation is outside of the qubits array, it will cause runtime error (since this is not handled explicitly).
  • If ParameterIndex of the parameter used in the ControlledRotation is outside of the parameters array, the gate will be quietly ignored (this is handled explicitly).

This makes errors fairly hard to find.

Expected behavior
I would expect both these behaviors be handled similarly, ideally by throwing an error "The model is invalid for reason X". For better performance we might want to validate the model closer to the entry points of the library, rather than on each call of ApplySequentialClassifier.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Kind-BugSomething isn't workingPkg-QMLIssue relates to the Microsoft.Quantum.MachineLearning package.Status-NeedsApiReviewThis PR requires an API review before merging in.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions