C1W1 -Received an array of 30 Tensors, but expected 1 to match the input keys dense_Dense1_input

link to classroom: https://www.coursera.org/learn/browser-based-models-tensorflow/home/week/1

This is the breast cancer week 1 assignment

I get this error in chrome:

Any thoughts on how i would go about troubleshooting this? I am running the javascript using a python webserver (run from VS code)
Many thanks in advance!
C

@Cormac_Garvey

is this the complete error log you got?

please don’t post any link to your assignment, it is against community guidelines.

Hi, yes this is the complete error…

can I know did you run the codes/assignment file in bracket multiple times??

Here is what resolved my issue when I had encountered not so similar issue. Deleting the complete folder of course from my local directory.

Re-downloading the folder and making sure to locate it to the local drive of my system.

Then making sure to keep the model architecture as simple as possible.

Referring to week 1 videos helps you resolve on how to create the model as well as the upgraded labs.

Also make sure you only write the codes in bracket where it mentions YOUR CODE HERE to END CODE HERE.

Another thing to cross check if your browser is update and the bracket app is also updated.

Let me know if addressing this resolves your issue.

Regards
DP

Im not using the bracket app ( some note somewhere said it was discontinued). Im using VS code for the (python ) webserver, and also to edit the HTML files. I restarted the python web server and also tried using chome incognito (browser is up to date) . I am running the file from a local directory which is the root directory of the webserver. Model arc simple are possible. 2 dense layers right? Many thanks

as suspected. Kindly do as I mentioned of deleting the files from local directory and redownload.

Make sure you have deleted the cache and browsing history too before you redownload the files in your system.

your issue is not with the number of dense layers.

If you notice the input keys is giving an incorrect output, than expected. So everytime you restart the tensorflow codes in the webchrome console is adding up.

Did you try the approach I mentioned!!!

Sorry as far as I remember it is execution of code from the vs code or bracket to the console in the chrome browser matters. So you using vs code should probably shouldn’t be issue as I have seen other learner also used it.

regards
DP

ok i deleted all browser cache, and recreated the files from scratch, and gave it a nee name. I still get the same error. So its likely that the code i copied from old file to new file has also copied the error.

one thing i was curious about was… why we dont have an input and flatten layer, but i guess that must be keras-specific

please don’t copy paste your codes.

Can you just send me screenshot of the codes of your model architecture where input shape is relative to number of features by personal DM

another thing is to check your codes for training data and testing data where you convert column names to array form.

Next your code asks you to specify the number of feature from your training. It provides hint that you get number of features from the number of columns and the number of labels in training data.

So this code would be

(await trainingData.columnNames()).length - 1

After this your model architecture code comes.

i actually hardcoded the number of columns. Its an integer right?

yes correct. it is lot simpler, refer the week1 video where Instructor is creating his model, notice the number of features how he mentions and uses them in training and testing data. You are suppose to do the same.

I also suspect there could be issue with your model architecture based on the error.

your first layer to the sequential model is tf.layers.dense mentions inputShape : [numOfFeatures] and activation as per classification you are doing if binary used sigmoid, if multiple softmax, then based on number of features, you could use number of units

and then next two more dense layer based on your specification.

I have provided necessary hints, you should be able to crack it up as I know you are good at programming.

But just let me know if you still need to look at your codes.

Regards
DP

1 Like

Thanks Deepti,
i have sent DM with model code for your review. :slightly_smiling_face:

Hi Deepti, did you get a chance to look at the screenshots i sent?
Many thanks
Cormac

sorry I somehow forgot to respond to you

try applying 3 layer but kee relu activation function only for 2nd layer

i tried that with a softmax layer, but it hasnt helped. Should i be tryinh a different activation type?

sigmoid, relu, sigmoid. 3 layer models. please tag my name as I didn’t get notification of your response, hence late response.

This didnt affect the error message. Here is the summary of my model . Does anything look wrong?

Thanks to stackoverflow for the following post which solved this, after 2 weeks of re doing the course and 3rd attempt from scratch to get this to work.

apparently you have to .batch() the converted training data, but this was no mentioned in any of the comments.

1 Like