Skip to content

Invalid dtype: complex64 #79

Description

@kinyanjuiprince21

When I run this code:

mel_spectrogram_layer = get_melspectrogram_layer(input_shape=input_shape,
                                 n_mels=128,
                                 pad_end=True,
                                 n_fft=512,
                                 win_length=400,
                                 hop_length=160,
                                 sample_rate=SR,
                                 return_decibel=True,
                                 input_data_format='channels_last',
                                 output_data_format='channels_last')

I get this error:

usr/local/lib/python3.10/dist-packages/kapre/time_frequency.py:110: UserWarning: Do not pass an `input_shape`/`input_dim` argument to a layer. When using Sequential models, prefer using an `Input(shape)` object as the first layer in the model instead.
  super(STFT, self).__init__(**kwargs)
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
[<ipython-input-4-4c6b029c218a>](https://localhost:8080/#) in <cell line: 106>()
    119     args, _ = parser.parse_known_args()
    120 
--> 121     train(args)

8 frames
[/usr/local/lib/python3.10/dist-packages/optree/ops.py](https://localhost:8080/#) in tree_map(func, tree, is_leaf, none_is_leaf, namespace, *rests)
    745     leaves, treespec = _C.flatten(tree, is_leaf, none_is_leaf, namespace)
    746     flat_args = [leaves] + [treespec.flatten_up_to(r) for r in rests]
--> 747     return treespec.unflatten(map(func, *flat_args))
    748 
    749 

ValueError: Exception encountered when calling STFT.call().

Could not automatically infer the output shape / dtype of 'stft' (of type STFT). Either the `STFT.call()` method is incorrect, or you need to implement the `STFT.compute_output_spec() / compute_output_shape()` method. Error encountered:

Invalid dtype: complex64

Arguments received by STFT.call():
  • args=('<KerasTensor shape=(None, 16000, 1), dtype=float32, sparse=None, name=keras_tensor>',)
  • kwargs=<class 'inspect._empty'>

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions