Praiseworthy
Praiseworthy

Reputation: 29

About tensorflow-wavelets

I'm trying to use the tensorflow-wavelets to use it as a layer. Everything so far is great, the problem is that my inputs are signal sequences, and when I run the code, it gives me error 1 below. When I searched in the code of the tensorflow-wavelets, I found out that the code used padding, which is specifically used for images, and I don't know what to do. Any help or suggestions? Also, I tried to use a customized layer or a customized function in order to avoid using the tensorflow-wavelets, but it gave me error 2. Any help, please?

error 1:

ValueError: Exception encountered when calling layer "db1" (type DWT).

in user code:

    File "C:\Users\maa\anaconda3\envs\py37\lib\site-packages\tensorflow_wavelets\Layers\DWT.py", line 52, in call  *
        inputs_pad = tf.pad(inputs, [[0, 0], [0, 0], [self.dec_len-1, self.dec_len-1], [0, 0]], self.border_padd)

    ValueError: Shape must be rank 4 but is rank 2 for '{{node db1/MirrorPad}} = MirrorPad[T=DT_FLOAT, Tpaddings=DT_INT32, mode="SYMMETRIC"](Placeholder, db1/MirrorPad/paddings)' with input shapes: [?,512], [4,2].


Call arguments received by layer "db1" (type DWT):
  • inputs=tf.Tensor(shape=(None, 512), dtype=float32)
  • training=None
  • mask=None

error 2:

NotImplementedError: Exception encountered when calling layer "activation_3" (type Activation).

Cannot convert a symbolic tf.Tensor (Placeholder:0) to a numpy array. This error may indicate that you're trying to pass a Tensor to a NumPy call, which is not supported.

Call arguments received by layer "activation_3" (type Activation):
  • inputs=tf.Tensor(shape=(None, 512), dtype=float32)

Upvotes: 0

Views: 446

Answers (1)

Praiseworthy
Praiseworthy

Reputation: 29

so I found a solution, which is to change the shape of my audio data so it could fit the DWT neural layer, but I still have problems with the shape of the output. And like I said before, this TensorFlow wavelet package is obviously supposed to deal with images, not signals. Another solution is to change the wavelet-tensorflow code so it can be applied to signals. For me, it didn't work, causing other errors like "AttributeError: 'Tensor' object has no attribute 'numpy'", even though I tried the eagrly mode and the graph mode, and nothing helped. If anyone has found another solution, feel free to comment so others can use your solution.

Upvotes: 1

Related Questions