get_variable_ddi

tfsnippet.utils.get_variable_ddi(name, initial_value, shape=None, dtype=tf.float32, initializing=False, regularizer=None, constraint=None, trainable=True, collections=None, **kwargs)

Wraps tf.get_variable() to support data-dependent initialization.

Parameters:
  • name – Name of the variable.
  • initial_value – The data-dependent initial value of the variable.
  • shape – Shape of the variable.
  • dtype – Data type of the variable.
  • initializing (bool) – Whether or not it is building the graph for data-dependent initialization? Ignored if initial_value is absent.
  • regularizer – Regularizer of the variable.
  • constraint – Constraint of the variable.
  • trainable (bool) – Whether or not to the variable is trainable?
  • collections (Iterable[str]) – Add the variable to these collections.
  • **kwargs – Other named parameters passed to tf.get_variable().
Returns:

The variable or the tensor.

Return type:

tf.Variable or tf.Tensor