0

I learning about deep learning using tensorflow.

While studying the code on github I saw an unknown :.

I searched variously, but the error appeared in the following section, and I could not solve the error.

I don't know if this error is a problem that doesn't return a float or that : problem.

   return self.test_images_name[(batch_num % ro_num) * batch_size: (batch_num % ro_num + 1) * batch_size], \
               self.test_eye_pos_name[(batch_num % ro_num) * batch_size: (batch_num % ro_num + 1) * batch_size], \
               self.test_ref_images_name[(batch_num % ro_num) * batch_size: (batch_num % ro_num + 1) * batch_size], \
               self.test_ref_pos_name[(batch_num % ro_num) * batch_size: (batch_num % ro_num + 1) * batch_size]

Error message

File "C:\Users\admin\Desktop\Exemplar-GAN-Eye-Inpainting-Tensorflow-master\Exemplar-GAN-Eye-Inpainting-Tensorflow-master\ExemplarGAN.py", line 154, in train train_data_list, batch_eye_pos, batch_train_ex_list, batch_ex_eye_pos = self.data_ob.getNextBatch(step2, self.batch_size) TypeError: 'NoneType' object is not iterable

Yugandhar Chaudhari
  • 3,831
  • 3
  • 24
  • 40
KScript
  • 53
  • 7

1 Answers1

3

It's the slice operator being applied to the lists, it just looks odd because of the long names, and because there's a space after the colon. If you simplify a bit, it's just:

i = (batch_num % ro_num) * batch_size
j = (batch_num % ro_num + 1) * batch_size

return self.test_images_name[i:j], \
       self.test_eye_pos_name[i:j], \
       self.test_ref_images_name[i:j], \
       self.test_ref_pos_name[i:j]

Apparently, one of these is None, so you can't index or slice it.

Michiel
  • 81
  • 4