C3 W1 Exercise 6

I am having a lot of trouble understanding why exercise 5 is failing. I get the following error:

TypeError: Incompatible shapes for dot: got (16, 13) and (15, 2).

I think my code is fine (as derived from other questions regarding this exercise), so I assume the issue should be on some previous code, but all the previous tests pass just fine.

I’m ussing the classifier as the learning model, giving the training_task, using the list eval_task as is for parameter eval_tasks, and assigning output_dir and n_steps where required.

I need some help to understand what’s going on, since I can’t really figure out where I went wrong.

Many thanks

Please click my name and message your notebook as an attachment.

1 Like

Probably you haven`t specified the axis argument in the tl.Mean() when creating the Model in Ex. 5.


Hey, I’ve got similar error.
TypeError: mul got incompatible shapes for broadcasting: (16, 2), (8, 2).

Any update here?

I didn’t get the notebook. How about you click my name and message your notebook as an attachment?

1 Like

Hey there I appologise, had a few days away from home and did not notice the repplies. I found @akavaev answer was enough to make the whole thing work properly. Thanks for the offering either way, maybe you can help Teddy if this did not help him

1 Like

Ping @Teddy_Huang for the notebook.

I have no idea how I fixed it, but I was experiencing the same error. I added the keepdims=True parameter to tl.Mean(axis=1) mentioned in another thread, to no avail. However, when I removed the parameter then run the code again it worked and I passed the unit test.

Not saying this is a definite fix, just what worked for me.

Good Afternoon, I am getting the following error for Exercise 6 of Week 1, Course 3:

ValueError: start_indices must have an integer type

I have confirmed that the data generator returns 3 tensors with dtype=int32. I am not clear what indices have the incorrect type.

My lab id is: acdylelr

Any help would be greatly appreciated. Thank you for your time.

I passed all tests in Exercises 1-5, but not Exercise 6. I have mean_layer = tl.Mean(axis=1), but still got the error:
TypeError: mul got incompatible shapes for broadcasting: (32, 2), (16, 2).

It seems that everyone got different shapes in the community. Any help would be appreciated.

Please fix targets in data_generator. Relying on indices to compute target_pos and target_neg is incorrect. See the counter of the for loop to know the number of positive and negative examples in the current batch.

I had the same error, I figured out it was related to the axis argument for tl.Mean().
using the default: axis=-1 will have this error.

My problem: TypeError: mul got incompatible shapes for broadcasting: (32, 2), (16, 2)
Original Problem: data_generator method, the number of rows of inputs and targets did not match after first iteration. (Thanks teacher Balaji gave me such useful hints)
Solution: check the shape of inputs and targets after second or more batch iteration; if do not match, perhaps that code that creates targets list has some problems.