add_weight

FullyConnected.add_weight(shape=None, initializer=None, dtype=None, trainable=True, regularizer=None, constraint=None, name=None)

Add a weight variable to the layer.

Parameters:
  • shape – Shape tuple for the variable. Must be fully-defined (no None entries). Defaults to () (scalar) if unspecified.

  • initializer – Initializer object to use to populate the initial variable value, or string name of a built-in initializer (e.g. “random_normal”). If unspecified, defaults to “glorot_uniform” for floating-point variables and to “zeros” for all other types (e.g. int, bool).

  • dtype – Dtype of the variable to create, e.g. “float32”. If unspecified, defaults to the layer’s variable dtype (which itself defaults to “float32” if unspecified).

  • trainable – Boolean, whether the variable should be trainable via backprop or whether its updates are managed manually.

  • constraint – Contrainst object to call on the variable after any optimizer update, or string name of a built-in constraint.

  • name – String name of the variable. Useful for debugging purposes.