取到一个batch的数据,计算概率
def calculate_y_prob_by_iterator(self, dataStream):
YArr,Y_preArr = [],[]
while True:
try:
X,Y,candidate = next(dataStream)
except:
break
Y_pre,Y = self.calculate_y_prob(X,candidate).cpu().data.numpy().astype(np.float32),Y.cpu().data.numpy().astype(np.int32)
YArr.append(Y)
Y_preArr.append(Y_pre)
YArr,Y_preArr = np.vstack(YArr),np.vstack(Y_preArr)
return Y_preArr, YArr