Neural Networks

Submodules

piqture.neural_networks.qcnn module

Quantum Convolutional Neural Network

class piqture.neural_networks.qcnn.QCNN(num_qubits: int)

Bases: QuantumNeuralNetwork

A Quantum Convolutional Neural Network implementation.

This class implements a quantum convolutional neural network by extending the base QuantumNeuralNetwork class. It provides functionality to build quantum circuits with convolutional-style quantum operations.

sequence(operations: list[tuple[Type[BaseLayer], dict]]) QuantumCircuit

Build a QNN circuit by composing the circuit with given sequence of operations.

Args:
operations (list[tuple[Type[BaseLayer], dict]]): A list of tuples where

each tuple contains a Layer class that inherits from BaseLayer and a dictionary of its arguments.

Returns:

QuantumCircuit: Final QNN circuit with all the layers applied.

Raises:
TypeError: If operations format is invalid or if any operation doesn’t

inherit from BaseLayer.

ValueError: If operations list is empty.

piqture.neural_networks.quantum_autoencoder module

piqture.neural_networks.quantum_neural_network module

Neural Network Abstract Base Class

class piqture.neural_networks.quantum_neural_network.QuantumNeuralNetwork(num_qubits: int)

Bases: ABC

Abstract base class for all quantum neural network structures.

These structures may consist of data encoding/embedding, model layers (consisting of layers such as convolutional, pooling, etc.), and a measurement stage.

property circuit

Returns the QCNN circuit.

abstractmethod sequence(operations: list[tuple[Callable, dict]])

Composes circuits with given list of operations.

Args:

operations (list[tuple[Callable, dict]]: a tuple of a Layer object and a dictionary of its arguments.