NEGU93/cvnn

ComplexUpSampling2D is too slow compiling

Opened this issue · 7 comments

Hello!

There are a problem with ComplexUpSampling2D: Is too slow (overmuch) compiling.

For now, to skip this problem I am doing something like this:

def CUpsampling2D(x):
r = UpSampling2D((2, 2))(tf.math.real(x))
i = UpSampling2D((2, 2))(tf.math.imag(x))
return tf.dtypes.complex(r, i, name=None)

But if I have time, I could calmly review to see how it can be solved.

Thank you for your code. It is being very useful for my master. :-)

Thank you for the feedback. I will try to give it a look.
Indeed, it's hard for me in many ways to keep up with TensorFlow performances. However, if it's too much I will try to take a look.

Does this happen with bilinear or nearest interpolation? or both?
If you can, could you provide an idea of time difference? (any code to test, exact time of one vs the other? any gist?)

Regards,

This code is taking 15 minutes to compile

in1 = Input(shape=(64,64,1),dtype=tf.complex64)
out = ComplexUpSampling2D()(in1)
model = Model(inputs=in1, outputs=out)

I proved disabling the eager execution, but it does not improve.

To compile! I miss-read and thought it was to run. Ok, there is definitively a problem. I will take a look. Thank you!

No. Once compiled, it runs very well.

Great, I created the gist and indeed it takes ages to compile.

One important remark, the code you sent me you use the Input layers, is that from TensorFlow? If so, be careful! The last time I checked, even if you use complex64 it casts the input to float32 and it tells you nothing. Probably it changed in newer versions but maybe it didn't. Is better if you use cvnn.layers.complex_input.

I proved the input layer in this gist, and it seems to work fine

Since Version 1.1.70 this bug is fixed.
However, as it can be seen here, the align_corners parameter is not longer supported.