This repository was archived by the owner on Jan 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 180
Simplify gradient estimation and classifier structure generation #200
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
551acb8
Clarify the restriction on the number of bits for IntAsBoolArray (#171)
tcNickolas d746df2
Package updates (#188)
bettinaheim 6c9561a
Quantum AND gates (a.k.a. CCNOT with constant target) (#186)
a01973a
Removed comment ref to IncrementByIntegerPhaseLE (#189)
numpde 39358f7
New Hadamard and SWAP test operations. (#196)
f1bd9d2
Refactor AA namespace to use Q# style guide (#197)
747ef78
Begin moving classifier structure creation to Q#.
cgranade 3553ad7
Moving example datasets into new namespace.
cgranade b1e762d
Fix datasets used in layered structure demo.
cgranade 097d485
Fixed bug with cyclic entangling layer.
cgranade b7d1f50
Merge branch 'master' into cgranade/structure-q#
cgranade 10283d9
Use new Hadamard test operation to simplify grad est.
cgranade 809f4b8
Simplify input encoder logic.
cgranade 7a2ab9c
Removed layer construction methods moved out to Q#.
cgranade 25806ca
Revised name of approximate input encoder.
cgranade 2496d91
Merge branch 'feature/qml' into cgranade/structure-q#
7aec262
Removed unused interop library.
cgranade 427bddc
Update pack script for new layout.
cgranade 7e25c47
Addressing feedback.
cgranade File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| namespace Microsoft.Quantum.MachineLearning { | ||
| open Microsoft.Quantum.Intrinsic; | ||
| open Microsoft.Quantum.Canon; | ||
| open Microsoft.Quantum.Math; | ||
|
|
||
| function unFlattenSchedule(sc : Int[][]) : SamplingSchedule | ||
| { | ||
| mutable ret = new Range[0]; | ||
| for (flattenedRange in sc) { | ||
| set ret += [flattenedRange[0]..flattenedRange[1]..flattenedRange[2]]; | ||
| } | ||
| return SamplingSchedule(ret); | ||
| } | ||
|
|
||
| function unFlattenLabeledSamples(dat:Double[][], labs:Int[]) : LabeledSample[] { | ||
| mutable cnt = MinI(Length(dat), Length(labs)); | ||
| mutable ret = new LabeledSample[cnt]; | ||
| for (j in 0..(cnt - 1)) { | ||
| set ret w/= j <- LabeledSample(dat[j], labs[j]); | ||
| } | ||
| return ret; | ||
| } | ||
|
|
||
| /// Debugging prop | ||
| operation unFlattenPauli(p:Int): Pauli | ||
| { | ||
| if (p==1) | ||
| { | ||
| return PauliX; | ||
| } | ||
| if (p==2) | ||
| { | ||
| return PauliY; | ||
| } | ||
| if (p==3) | ||
| { | ||
| return PauliZ; | ||
| } | ||
| return PauliI; | ||
| } | ||
|
|
||
| /// Debugging prop | ||
| /// upcasting controlled rotation in flat representation (paramIx,pauliIx,gateSpan) | ||
| operation unFlattenControlledRotation(cod:Int[]): ControlledRotation { | ||
| return ControlledRotation( | ||
| GateSpan( | ||
| cod[2], cod[3...] | ||
| ), | ||
| unFlattenPauli(cod[1]), | ||
| cod[0] | ||
| ); | ||
| } | ||
|
|
||
| /// Debugging prop | ||
| operation unFlattenGateSequence(seq: Int[][]) : GateSequence { | ||
| mutable tmp = new ControlledRotation[Length(seq)]; | ||
| for (icr in 0..(Length(seq) - 1)) { | ||
| set tmp w/= icr <- unFlattenControlledRotation(seq[icr]); | ||
| } | ||
| return GateSequence(tmp); | ||
| } | ||
|
|
||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.