Getting Started

Welcome to my library! [CIT2019-BARRACHINA-CODE]


The idea of this library is just to implement Complex layers (ComplexLayer) so that everything else stays the same as any Tensorflow code.

The only difference with a Tensorflow code is that you should use cvnn.layers module instead of tf.keras.layers.

Although tf.activation and tf.initializers could be used, it is HIGHLY recommended (and some times compulsory) to use the cvnn module options.


For a reason I ignore, TensorFlow casts the input automatically to floating. To avoid this, always create first a ComplexInput layer in all your models.

If you are here is because you want to train a Complex-Valued Neural Network (CVNN). Use the following link for a quick tutorial.

Real-valued case

Although this library is intended to work with complex data type, it also supports real dtype by just using the dtype parameter in each ComplexLayer constructor.

All cvnn activation functions and initializers already work Ok for real and complex inputs, so nothing should change.

This allows me to debug the code (comparing it’s result with keras on real data) but also to easily implement a comparison between a complex and a real network minimizing the error.

You have some examples of this as for example MNIST.


Please, remember to cite me accordingly [CIT2019-BARRACHINA-CODE]

[CIT2019-BARRACHINA-CODE](1, 2) Jose Agustin Barrachina. “Complex-Valued Neural Networks (CVNN)”. GitHub repository.