Skip to main contentIBM Quantum Documentation
This page is from an old version of Qiskit SDK and does not exist in the latest version. We recommend you migrate to the latest version. See the release notes for more information.

qiskit.aqua.components.neural_networks.GenerativeNetwork

class GenerativeNetwork

GitHub

Base class for generative Quantum and Classical Neural Networks.

This method should initialize the module, but raise an exception if a required component of the module is not available.

__init__

abstract __init__()

Initialize self. See help(type(self)) for accurate signature.


Methods

__init__()Initialize self.
get_output(quantum_instance, params, shots)Apply quantum/classical neural network to given input and get the respective output
loss()Loss function used for optimization
set_seed(seed)Set seed.
train([quantum_instance, shots])Perform one training step w.r.t to the generator’s parameters

get_output

abstract get_output(quantum_instance, params, shots)

Apply quantum/classical neural network to given input and get the respective output

Parameters

  • quantum_instance (QuantumInstance) – Quantum Instance, used to run the generator circuit.
  • params (numpy.ndarray) – parameters which should be used to run the generator, if None use self._params
  • shots (int) – if not None use a number of shots that is different from the number set in quantum_instance

Returns

Neural network output

Raises

NotImplementedError – not implemented

loss

abstract loss()

Loss function used for optimization

set_seed

abstract set_seed(seed)

Set seed.

Parameters

seed (int) – seed

Raises

NotImplementedError – not implemented

train

abstract train(quantum_instance=None, shots=None)

Perform one training step w.r.t to the generator’s parameters

Parameters

  • quantum_instance (QuantumInstance) – used to run generator network. Ignored for a classical network.
  • shots (int) – Number of shots for hardware or qasm execution. Ignored for classical network

Returns

generator loss and updated parameters.

Return type

dict

Raises

NotImplementedError – not implemented

Was this page helpful?
Report a bug or request content on GitHub.