【发布时间】:2017-04-25 20:35:56
【问题描述】:
我最近实现了这个 make_parallel 代码 (https://github.com/kuza55/keras-extras/blob/master/utils/multi_gpu.py) 用于在多个 GPU 上进行测试。在实现 predict_classes() 函数后,新模型结构无法正常工作,经过一番阅读,我转而使用 predict 函数。此功能仅适用于某些批量大小,例如 750 的批量大小有效,而 500、100 和 350 则失败并出现以下错误:
ValueError: could not broadcast input array from shape (348,15) into shape
(350,15)
训练以 75 的 batch_size 完成。知道为什么会发生这种情况或如何解决吗?
pointFeatures = np.zeros((batchSize,featureSize))
libfeatures.getBatchOfFeatures(i,batchSize,pointFeatures)
pointFeatures = pointFeatures.reshape(batchSize, FeatureShape.img_rows,
FeatureShape.img_cols, FeatureShape.img_width,
FeatureShape.img_channels)
pointFeatures = pointFeatures.astype('float32')
results = model.predict(pointFeatures, verbose=True,
batch_size=FeatureShape.mini_batch_size)
【问题讨论】:
标签: python tensorflow gpu keras