Linguaggi
English
Bengali
French
Hindi
Italian
Japanese
Korean
Malayalam
Russian
Spanish
Tamil
Turkish
Vietnamese



NeuralNetwork

class NeuralNetwork(num_inputs, num_weights, sparse, output_shape, input_gradients=False)[sorgente]

Basi: ABC

Abstract Neural Network class providing forward and backward pass and handling batched inputs. This is to be implemented by other (quantum) neural networks.

Parametri:
  • num_inputs – The number of input features.

  • num_weights – The number of trainable weights.

  • sparse – Determines whether the output is a sparse array or not.

  • output_shape – The shape of the output.

  • input_gradients – Determines whether to compute gradients with respect to input data.

Solleva:

QiskitMachineLearningError – Invalid parameter values.

Attributes

input_gradients

Returns whether gradients with respect to input data are computed by this neural network in the backward method or not.

num_inputs

Returns the number of input features.

num_weights

Returns the number of trainable weights.

output_shape

Returns the output shape.

sparse

Returns whether the output is sparse or not.

Methods

backward(input_data, weights)

Backward pass of the network.

forward(input_data, weights)

Forward pass of the network.