Comments (4)
It is indeed strange, at some point the data is becoming real valued. I have some request if you could.
- Can you show me the output of
model.summary()
? - Which version of the code are you using? Be sure to always keep the last version and try to favour PIP over ANACONDA.
- Could you provide a MWE? Maybe generate a random dataset and upload the code. If you use Google colab you can even run the code on a cloud.
Thank you very much.
from cvnn.
I am closing this issue due to inactivity. If you (or someone) come across this issue again just comment and I will re-open it.
from cvnn.
Hello!
Thank you very much for this library to treat complex values.
I have the same issue. The warning appears for the 3rd layer of after the I used the code you provided in the doc of the simple example, https://complex-valued-neural-networks.readthedocs.io/en/latest/cvnn.html.
The code used
import numpy as np
import cvnn.layers as complex_layers
import tensorflow as tf
def get_dataset():
(train_images, train_labels), (test_images, test_labels) = tf.keras.datasets.cifar10.load_data()
train_images = train_images.astype(dtype=np.complex64) / 255.0
test_images = test_images.astype(dtype=np.complex64) / 255.0
return (train_images, train_labels), (test_images, test_labels)
p=tf.config.list_physical_devices('GPU')
tf.config.experimental.set_memory_growth(p[0], True)
(train_images, train_labels), (test_images, test_labels) = get_dataset() # to be done by each user
model = tf.keras.models.Sequential()
model.add(complex_layers.ComplexInput(input_shape=(32, 32, 3))) # Always use ComplexInput at the start
model.add(complex_layers.ComplexConv2D(32, (3, 3), activation='cart_relu'))
model.add(complex_layers.ComplexAvgPooling2D((2, 2)))
model.add(complex_layers.ComplexConv2D(64, (3, 3), activation='cart_relu'))
model.add(complex_layers.ComplexMaxPooling2D((2, 2)))
model.add(complex_layers.ComplexConv2D(64, (3, 3), dtype=np.complex64, activation='cart_relu'))
model.add(complex_layers.ComplexFlatten())
model.add(complex_layers.ComplexDense(64, activation='cart_relu'))
model.add(complex_layers.ComplexDense(10, activation='convert_to_real_with_abs'))
model.compile(optimizer='adam',
loss=tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True),
metrics=['accuracy'])
model.summary()
#p=tf.config.list_physical_devices('GPU')
#Train model
history = model.fit(train_images, train_labels, epochs=6, validation_data=(test_images, test_labels))
#Evaluate model
test_loss, test_acc = model.evaluate(test_images, test_labels, verbose=2)
The output of the terminal
Model: "sequential"
Layer (type) Output Shape Param #
complex_conv2d (ComplexConv2 (None, 30, 30, 32) 1792
complex_avg_pooling2d (Compl (None, 15, 15, 32) 0
complex_conv2d_1 (ComplexCon (None, 13, 13, 64) 36992
complex_max_pooling2d (Compl (None, 6, 6, 64) 0
complex_conv2d_2 (ComplexCon (None, 4, 4, 64) 73856
complex_flatten (ComplexFlat (None, 1024) 0
complex_dense (ComplexDense) (None, 64) 131200
complex_dense_1 (ComplexDens (None, 10) 1300
Total params: 245,140
Trainable params: 245,140
Non-trainable params: 0
2022-04-07 17:48:26.016937: W tensorflow/core/framework/cpu_allocator_impl.cc:81] Allocation of 1228800000 exceeds 10% of free system memory.
Epoch 1/6
WARNING: complex_conv2d_2 - Expected input to be <dtype: 'complex64'>, but received <dtype: 'float32'>.
This is normally fixed using ComplexInput() at the start (tf casts input automatically to real).
The library was install with pip and the version is 1.0.0.
Thank you very much.
from cvnn.
I don't have this problem. Here you have the notebook with the code.
Please be sure to update the library cvnn just in case.
from cvnn.
Related Issues (20)
- Model subclassing compatibility HOT 4
- load CVNN model with succes HOT 1
- Implement complex-valued constraint parameter HOT 7
- Terrible slow caused by ComplexBatchNormalization() HOT 4
- Custom Activation Functions with tensorflow 2.8.2 HOT 1
- Pytorch implementation HOT 3
- ComplexConv2D with bias vector slows down training a lot HOT 7
- "WARNING:tensorflow: You are casting an input of type complex64 to an incompatible dtype float32. This will discard the imaginary part and may not be what you intended." HOT 5
- ModuleNotFoundError: No module named 'cvnn.montecarlo' HOT 1
- Unknown activation function 'cart_relu': Please ensure this object is passed to 'custom objects' argument HOT 5
- Cant find Complex Softmax which takes complex input and output complex output HOT 1
- Best Activation Function in Complex Domain HOT 1
- using this function layers.complex_input(shape=input_shape + (3,)) gives off dtype error HOT 2
- Problem with loading complex valued model HOT 2
- Equivalent Data PreProcessing for complex-valued input
- Data Parallel Distributed support HOT 4
- Best way to convert Real data into complex data type HOT 1
- Type type error for "ComplexInput" HOT 2
- Error while adding a layer HOT 2
- ValueError: Invalid dtype: complex64 with TF 2.16+ HOT 15
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cvnn.