def get_chunk(samples, labels, chunkSize):
 if (len(samples) != len(labels)):
  raise Exception('Length of samples and labels must equal')
 stepStart = 0
 i = 0
 while (stepStart < len(samples)):
  stepEnd = (stepStart + chunkSize)
  if (stepEnd < len(samples)):
   (yield (i, samples[stepStart:stepEnd], labels[stepStart:stepEnd]))
   i += 1
  stepStart = stepEnd

def get_chunk ( samples , labels , chunkSize ) : if ( len ( samples ) != len ( labels ) ) : raise Exception ( 'Length of samples and labels must equal' ) stepStart = 0 i = 0 while ( stepStart < len ( samples ) ) : stepEnd = ( stepStart + chunkSize ) if ( stepEnd < len ( samples ) ) : ( yield ( i , samples [ stepStart : stepEnd ] , labels [ stepStart : stepEnd ] ) ) i += 1 stepStart = stepEnd
iterator/generator: get a batch of data 这个函数是一个迭代器/生成器，用于每一次只得到 chunksize 这么多的数据 用于 for loop， just like range() function .