Skip to content

Implement complex-valued constraint parameter #28

@j-peetz

Description

@j-peetz

Hello @NEGU93, thank you for making this library! I'm attempting to use the arguments "use_bias" and "kernel_constraint" within "ComplexDense" as so:

self.d1 = complex_layers.ComplexDense(dim, use_bias=False, kernel_constraint=ConstantWeights())

However, these arguments seem to have no effect -- there are still biases, and the constraints on the weights are not enforced. That is, the layer performs identically to this:

self.d1 = complex_layers.ComplexDense(dim)

I tried the same arguments with tf.keras.layers.Dense and got the desired behaviors. Please let me know if I misunderstand how to use these. Thanks in advance!

Here's the relevant context, in case it helps:

class ConstantWeights(tf.keras.constraints.Constraint):
    def __call__(self, w):
        tf.keras.backend.set_value(w[0, 0], 3)
        tf.keras.backend.set_value(w[1, 2], 3)
        return w

class MyModel(Model):
    def __init__(self):
        super(MyModel, self).__init__()
        self.d1 = complex_layers.ComplexDense(dim, use_bias=False, kernel_constraint=ConstantWeights())

    def call(self, x):
        x = self.d1(x)
        return x

model = MyModel()

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions