Helpers

Module name: qmlt.tf.helpers

Code author: Maria Schuld <maria@xanadu.ai>

Collection of helpers to set up an experiment with the tensorflow circuit learner.

Summary

make_param([name, stdev, mean, interval, …]) Return a tensorflow variable.

Code details

qmlt.tf.helpers.make_param(name=None, stdev=None, mean=0.0, interval=None, constant=None, shape=(), regularize=False, monitor=False, seed=None)[source]

Return a tensorflow variable.

Parameters:
  • name (str) – name of the variable
  • stdev (float) – If not None, initialise from normal distribution.
  • mean (float) – If stdev is not None, use this mean for normal distribution. Defaults to 0.
  • interval (list of length 2) – If stdev is None and interval is not None, initialise from random value sampled uniformly from this interval.
  • constant (float) – If stdev and interval are both None and constant is not None, use this as an initial value. If constant is also None, use 0 as an initial value (not recommended!).
  • shape (tuple or list) – Shape of variable tensor. Useful for layered architectures.
  • regularize (boolean) – If true, mark this parameter for regularization.
  • monitor (boolean) – Whether to add this variable to tensorboard summary.
  • seed (int) – Use this seed to generate random numbers.