今日のローカルTensorFlowEverywhereイベントの出欠確認!

tfq.optimizers.rotosolve_minimize

Applies the rotosolve algorithm.

The rotosolve algorithm can be used to minimize a linear combination

of quantum measurement expectation values. See the following paper:

arXiv:1903.12166, Ken M. Nakanishi. arXiv:1905.09692, Mateusz Ostaszewski.

Usage:

Here is an example of optimize a function which consists summation of a few sinusoids.

n = 10  # Number of sinusoids
coefficient = tf.random.uniform(shape=[n])
min_value = -tf.math.reduce_sum(tf.abs(coefficient))
func = lambda x:tf.math.reduce_sum(tf.sin(x) * coefficient)
# Optimize the function with rotosolve, start with random parameters
result = tfq.optimizers.rotosolve_minimize(func, np.random.random(n))
result.converged
tf.Tensor(True, shape=(), dtype=bool)
result.objective_value
tf.Tensor(-4.7045116, shape=(), dtype=float32)

expectation_value_function A Python callable that accepts a point as a real tf.Tensor and returns a tf.Tensors of real dtype containing the value of the function. The function to be minimized. The input is of shape [n], where n is the size of the trainable parameters. The return value is a real tf.Tensor Scalar (matching shape [1]). This must be a linear combination of quantum measurement expectation value, otherwise this algorithm cannot work.
initial_position Real tf.Tensor of shape [n]. The starting point, or points when using batching dimensions, of the search procedure. At these points the function value and the gradient norm should be finite.
tolerance Scalar tf.Tensor of real dtype. Specifies the tolerance for the procedure. If the supremum norm between two iteration vector is below this number, the algorithm is stopped.
name (Optional) Python str. The name prefixed to the ops created by this function. If not supplied, the default name 'minimize' is used.

optimizer_results A RotosolveOptimizerResults object contains the result of the optimization process.