fversaci/WaveTF

I got ValueError when calling the layer

Closed this issue · 4 comments

rl = tf.nn.conv1d(s1, k1l, stride=2, padding='VALID')

ValueError: Shape must be rank 4 but is rank 5 for 'conv1d' (op: 'Conv2D') with input shapes: [1,1,768,256,1], [1,2,1,1].

With my code:

tf.reset_default_graph()
img = tf.placeholder(tf.float32, shape=(1, 256, 256, 3))
features = HaarWaveLayer2D().call(img)

Any ideas why?

Hi, it seems you're using Tensorflow 1, which is not tested/supported.

I tried the following code with Tensorflow 2 and runs without errors:

import tensorflow as tf
from wavetf._haar_conv import HaarWaveLayer2D

tf.compat.v1.disable_eager_execution()
img = tf.compat.v1.placeholder(tf.float32, shape=(1, 256, 256, 3))
features = HaarWaveLayer2D().call(img)
print(features.shape)

Also, are you using the latest version of WaveTF (v0.1.1 = current master)?

Hi, it seems you're using Tensorflow 1, which is not tested/supported.

I tried the following code with Tensorflow 2 and runs without errors:

import tensorflow as tf
from wavetf._haar_conv import HaarWaveLayer2D

tf.compat.v1.disable_eager_execution()
img = tf.compat.v1.placeholder(tf.float32, shape=(1, 256, 256, 3))
features = HaarWaveLayer2D().call(img)
print(features.shape)

Also, are you using the latest version of WaveTF (v0.1.1 = current master)?

bad... I'm using tf1 :(

Does this class work for
img = tf.compat.v1.placeholder(tf.float32, shape=(None, None, None, 3)) ?

No, you must provide at least the x and y (and channels) dimensions.