'Adds a weight variable to the layer.
# Arguments
name: String, the name for the weight variable.
shape: The shape tuple of the weight.
dtype: The dtype of the weight.
initializer: An Initializer instance (callable).
regularizer: An optional Regularizer instance.
trainable: A boolean, whether the weight should
be trained via backprop or not (assuming
that the layer itself is also trainable).
constraint: An optional Constraint instance.
# Returns
The created weight variable.'

@interfaces.legacy_add_weight_support
def add_weight(self, name, shape, dtype=None, initializer=None, regularizer=None, trainable=True, constraint=None):

    initializer = initializers.get(initializer)
    if (dtype is None):
        dtype = K.floatx()
    weight = K.variable(initializer(shape), dtype=dtype, name=name, constraint=constraint)
    if (regularizer is not None):
        self.add_loss(regularizer(weight))
    if trainable:
        self._trainable_weights.append(weight)
    else:
        self._non_trainable_weights.append(weight)
    return weight
