这个冒号是什么意思? [英] What does this colon mean?
问题描述
我使用 tensorflow 学习了深度学习.
I learning about deep learning using tensorflow.
在github上研究代码时,我看到了一个未知的:
.
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]
错误消息
文件 "C:\ Users \ admin \ Desktop \ Exemplar-GAN-Eye-Inpainting-Tensorflow-master \ Exemplar-GAN-Eye-Inpainting-Tensorflow-master \ ExemplarGAN.py",第154行,在火车上 train_data_list,batch_eye_pos,batch_train_ex_list,batch_ex_eye_pos = self.data_ob.getNextBatch(step2,self.batch_size) TypeError:"NoneType"对象不可迭代
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
推荐答案
这是 slice运算符应用于列表时,由于长名称以及冒号后面有空格,因此看起来很奇怪.如果您简化一点,那就是:
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.
这篇关于这个冒号是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!