ensemble
eigenkit.torch.layers.ensemble
An ensemble of independent quantum circuits, one for each chunk of the input.
It splits the input into chunks of n_qubits features and runs one independent
circuit on each chunk, each with its own weights. The outputs are concatenated
along the feature dimension.
Ensemble
Bases: Module
An ensemble of independent quantum circuits, one for each chunk of the input.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
in_features
|
int
|
The total number of input features. It must be a multiple of
|
required |
n_qubits
|
int
|
The number of qubits of each circuit. |
required |
depth
|
int
|
The number of variational layers of each circuit. |
required |
enc_rotation
|
Literal['RX', 'RY', 'RZ']
|
The encoding rotation: |
'RX'
|
var_rotation
|
Literal['RX', 'RY', 'RZ']
|
The variational rotation. It is used only when
|
'RY'
|
variational_type
|
Literal['basic', 'strong']
|
|
'strong'
|
basis
|
Literal['X', 'Y', 'Z']
|
The Pauli measurement basis: |
'Z'
|
provider
|
ProviderSpec
|
The backend that runs the circuits. Default: |
'numpy'
|
Example
provider
property
The backend that the circuits of this layer were compiled for.
The constructor takes provider= in the same forms as Circuit (a
registered name, a configuration or a backend object) and turns it into
one Provider. This property returns it. The registered name is
provider.name.
Returns:
| Name | Type | Description |
|---|---|---|
provider |
Provider
|
The backend that the circuits run on. |
forward(x)
Run the layer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Tensor
|
The input batch, of shape |
required |
Returns:
| Name | Type | Description |
|---|---|---|
out |
Tensor
|
The output of the layer for that batch. |