pub struct QMaxPool { /* private fields */ }Expand description
Quantum pooling layer using maximum measurement probability
Reduces the number of qubits by measuring subsets and keeping the qubit with the highest measurement probability in each pool.
Implementations§
Source§impl QMaxPool
impl QMaxPool
Sourcepub fn new(n_wires: usize, pool_size: usize, stride: usize) -> MLResult<Self>
pub fn new(n_wires: usize, pool_size: usize, stride: usize) -> MLResult<Self>
Create a new quantum max pooling layer
§Arguments
n_wires- Number of input qubitspool_size- Size of each pooling windowstride- Step size for pooling windows
§Example
ⓘ
// 8-qubit input, pool size 2, stride 2
let pool = QMaxPool::new(8, 2, 2)?;
// Will pool: (0,1), (2,3), (4,5), (6,7) -> 4 output qubitsSourcepub fn pool_positions(&self) -> Vec<usize>
pub fn pool_positions(&self) -> Vec<usize>
Get the positions where pooling windows start
Sourcepub fn pool_qubits(&self, position: usize) -> Vec<usize>
pub fn pool_qubits(&self, position: usize) -> Vec<usize>
Get the qubit indices for a specific pool
Sourcepub fn output_size(&self) -> usize
pub fn output_size(&self) -> usize
Calculate the number of output qubits after pooling
Trait Implementations§
Auto Trait Implementations§
impl Freeze for QMaxPool
impl RefUnwindSafe for QMaxPool
impl Send for QMaxPool
impl Sync for QMaxPool
impl Unpin for QMaxPool
impl UnwindSafe for QMaxPool
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.