CVQNN Module#
Some tools for simulating CVQNN (Continuous-Variable Quantum Neural Networks) are also available in Piquasso.
- generate_random_cvqnn_weights(layer_count: int, d: int, active_var: float = 0.01, passive_var: float = 0.1) ndarray#
- Generates random CVQNN weights for - create_program().
- create_layers(weights: ndarray) Program#
- Creates a subprogram from the specified weights. - Example usage: - import piquasso as pq weights = pq.cvqnn.generate_random_cvqnn_weights(layer_count=10, d=5) cvnn_layers = pq.cvqnn.create_program(weights) with pq.Program() as program: for i in range(d): pq.Q(i) | pq.Displacement(r=0.1) pq.Q() | cvnn_layers - Parameters:
- weights (np.ndarray) – The CVQNN circuit weights. 
- Returns:
- The program of the CVQNN circuit, ready to be executed. 
- Return type:
 
- create_program(weights: ndarray) Program#
- Creates a Program from the specified weights, with vacuum initial state. - Parameters:
- weights (np.ndarray) – The CVQNN circuit weights. 
- Returns:
- The program of the CVQNN circuit, ready to be executed. 
- Return type:
 
- get_number_of_modes(number_of_parameters: int) int#
- Returns the number of modes given the number of parameters in a CVQNN layer. - Parameters:
- number_of_parameters (int) – The number of CVQNN parameters per layer. 
- Raises:
- CVQNNException – If the number of parameters does not correspond to any number of modes 
- Returns:
- The number of modes. 
- Return type: