TypeError: object of type 'int' has no len()

while training my model, I am getting this error. when I removed the len, it still showed the same error.

TypeError Traceback (most recent call last)

in <cell line: 2>() 1 # parameters (feel free to change this) ----> 2 train_steps = len(50000) // BATCH_SIZE 3 val_steps = len(10000) // BATCH_SIZE 4 5 ### START CODE HERE ###

TypeError: object of type ‘int’ has no len()

len() is a method for lists, why are you using len() in this way, whats the idea behind?

I didn’t use, it was already given for the assignment. I am not suppose to remove whatever is give before right?? ok I removed the len and now its training. I don’t get why did they add len ???

It doesnt make sense for len to be there.

I surely didn’t put there :joy: as I am already learning to do the course.

it was mention like this len(train_size) // BATCH_SIZE

Which assignment was this exactly, I cant find it.

TensorFlow: Advanced Techniques Specialization
Course 4: Generative Deep Learning with TensorFlow
Week 2: Programming Assignment: AutoEncoder Model Loss and Accuracy

No its not as you point, you must have changed it and created the issue. This is what I have and I just opened it:

So try to be more careful next time.

yes this is what it was and I did not change anything, I only replaced train_dataset with 50000 and test_dataset with 10000

ok understood what mistake I did, I shouldn’t have change that part of the code :see_no_evil: :rofl: :nerd_face:

1 Like

You can change it but not replacing a list with an integer!

got it, I am doing lately silly mistakes :frowning:

I am having a doubt for week 3 now, but I am unable to create a new post?? what should I do