MATLAB Answers

LSTM error with number of X and Y observations

9 views (last 30 days)
Daniel Guo
Daniel Guo on 14 Apr 2020
Commented: Daniel Guo on 14 Apr 2020
I am using lstm regression network to denoise speech. The predictor input consists of 9 consecutive noisy STFT vectors. The target is corresponding clean STFT vector. The length of each vector is 129.
Here 's the network I defined:
layers = [
sequenceInputLayer([129 9 1],"Name","sequence")
I trained the network with X and Y of sizes:
129 9 1 254829
129 254829
I got the error "Invalid training data. X and Y must have the same number of observations". I think that maybe the network I defined is wrong. I am new with lstm network to do sequence-to-sequence regression. What should I do with my network or training data?
Thanks for your help!


Sign in to comment.

Accepted Answer

jibrahim on 14 Apr 2020
Hi Daniel,
Please refer to the help of trainNetwork for info on correct input sizes for sequences.
The inputs must be cell arrays. Here is an example with two observations:
opts = trainingOptions('adam');
trainNetwork({randn(129,9,1) , randn(129,9,1)}, {randn(129,1),randn(129,1)},layers,opts)

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!