- class TorchConnector(*args, **kwargs)¶
Connects a Qiskit (Quantum) Neural Network to PyTorch.
neural_network -- The neural network to be connected to PyTorch. Remember that
input_gradientsmust be set to
Truein the neural network initialization before passing it to the
TorchConnectorfor the gradient computations to work properly during training.
initial_weights -- The initial weights to start training the network. If this is None, the initial weights are chosen uniformly at random from [-1, 1].
sparse -- Whether this connector should return sparse output or not. If sparse is set to None, then the setting from the given neural network is used. Note that sparse output is only returned if the underlying neural network also returns sparse output, otherwise an error will be raised. Sparse support works on python 3.8 or higher.
- उभारता है :
QiskitMachineLearningError -- If the connector is configured as sparse and the underlying network is not sparse. Or if python version is 3.7.
- प्रदत्त प्रकार :
Returns the underlying neural network.
Returns whether this connector returns sparse output or not.
Returns the weights of the underlying network.