prevision_quantum_nn.models.pennylane_backend.qnn_pennylane_cv

Continuous variable module

Module Contents

Classes

CVNeuralNetwork

Class CVNeuralNetwork.

class prevision_quantum_nn.models.pennylane_backend.qnn_pennylane_cv.CVNeuralNetwork(params)

Bases: prevision_quantum_nn.models.pennylane_backend.qnn_pennylane.PennylaneNeuralNetwork

Class CVNeuralNetwork. Implements a neural network on Continuous Variable architecture

cutoff_dim

cutoff dimension of the strawberryfields backend

Type

int

dev

device to be used to train the model

Type

qml.device

build(self, weights_file=None)

builds the backend and the device

check_encoding(self)

Checks encoding consistency.

Raises

ValueError if invalid encoding for CV calculation

initialize_weights(self, weights_file=None)

Initializes weights.

Parameters

weights_file (str) – option, if None, the weights will be initialized randomly if not None, weights will be loaded from file

encode_data(self, features)

Encodes data according to encoding method.

Parameters

x (array) – Array of features to be embedded

layers(self, variables)

Layers of the model.

Depending on layer_type, the layers will either be custom or template

Parameters

variables (list) – weights of the model

output_layer(self)

Output layer.

Returns

quantum observables

Return type

list