pyqrack.qrack_neuron_torch_layer¶
Attributes¶
Classes¶
Static forward/backward/apply functions for QrackNeuronTorch |
|
Torch wrapper for QrackNeuron |
|
Torch layer wrapper for QrackNeuron (with maximally expressive set of neurons between inputs and outputs) |
Functions¶
|
Module Contents¶
- pyqrack.qrack_neuron_torch_layer._IS_TORCH_AVAILABLE = True¶
- pyqrack.qrack_neuron_torch_layer._IS_TORCH_AVAILABLE = False¶
- pyqrack.qrack_neuron_torch_layer.param_shift_eps = 1.5707963267948966¶
- pyqrack.qrack_neuron_torch_layer.init_phi¶
- pyqrack.qrack_neuron_torch_layer.fp_type¶
- class pyqrack.qrack_neuron_torch_layer.QrackNeuronTorchFunction¶
Bases:
Function if _IS_TORCH_AVAILABLE else objectStatic forward/backward/apply functions for QrackNeuronTorch
- static _apply(angles, neuron)¶
- static forward(ctx, x, neuron)¶
- static _backward(angles, neuron, simulator)¶
- static backward(ctx, grad_output)¶
- class pyqrack.qrack_neuron_torch_layer.QrackNeuronTorch(neuron, x)¶
Bases:
nn.Module if _IS_TORCH_AVAILABLE else objectTorch wrapper for QrackNeuron
- neuron¶
QrackNeuron backing this torch wrapper
- Type:
- neuron¶
- weights¶
- forward()¶
- pyqrack.qrack_neuron_torch_layer.dummy_post_init_fn(simulator)¶
- class pyqrack.qrack_neuron_torch_layer.QrackNeuronTorchLayer(input_qubits, output_qubits, hidden_qubits=None, lowest_combo_count=0, highest_combo_count=2, activation=int(NeuronActivationFn.Generalized_Logistic), parameters=None, post_init_fn=dummy_post_init_fn, **kwargs)¶
Bases:
nn.Module if _IS_TORCH_AVAILABLE else objectTorch layer wrapper for QrackNeuron (with maximally expressive set of neurons between inputs and outputs)
- simulator¶
Prototype simulator that batching copies to use with QrackNeuron instances. (You may customize or overwrite the initialization or reference, before calling forward(x).)
- Type:
- simulators¶
In-flight copies of prototype simulator corresponding to batch count
- Type:
list[QrackSimulator]
- input_indices¶
simulator qubit indices used as QrackNeuron inputs
- Type:
list[int], read-only
- output_indices¶
simulator qubit indices used as QrackNeuron outputs
- Type:
list[int], read-only
simulator qubit indices used as QrackNeuron hidden inputs (in maximal superposition)
- Type:
list[int], read-only
- neurons¶
QrackNeuronTorch wrappers (for PyQrack QrackNeurons) in this layer, corresponding to weights
- Type:
ModuleList[QrackNeuronTorch]
- weights¶
List of tensors corresponding one-to-one with weights of list of neurons
- Type:
ParameterList
- apply_fn¶
Corresponds to QrackNeuronTorchFunction.apply(x, neuron_wrapper) (or override with a custom implementation)
- Type:
Callable[Tensor, QrackNeuronTorch]
- post_init_fn¶
Function that is applied after forward(x) state initialization, before inference. (As the function depends on nothing but the simulator, it’s differentiable.)
- Type:
Callable[QrackSimulator]
- simulator¶
- simulators = []¶
- input_indices¶
- hidden_indices¶
- output_indices¶
- activation¶
- dtype¶
- apply_fn¶
- post_init_fn¶
- neurons¶
- forward(x)¶