Keras multi_gpu_model错误:“swig / python检测到'int64_t *'类型的内存泄漏,没有找到析构函数”

时间:2018-03-03 05:49:34

标签: python tensorflow keras gpu multi-gpu

我使用的是tensorflow 1.5.0,tensorflow-gpu 1.3.0,keras 2.0.9,keras-gpu 2.1.4

我使用此代码创建了我的模型:

inputs = Input([1,44,44,44])
x = Conv3D(64, (3,3,3), activation='relu', data_format='channels_first')(inputs)
x = Conv3D(16, (3,3,3), activation='relu', data_format='channels_first')(x)
x = Conv3D(1, (3,3,3), activation='relu', data_format='channels_first')(x)
model = Model(inputs=inputs, outputs=x)

我想在我的机器上使用两个GPU。 但是当我使用

from keras.utils import multi_gpu_model
parallel_model = multi_gpu_model(model, gpus=2)

我收到此错误:

swig/python detected a memory leak of type 'int64_t *', no destructor found.
swig/python detected a memory leak of type 'int64_t *', no destructor found.
swig/python detected a memory leak of type 'int64_t *', no destructor found.

有什么建议吗?

1 个答案:

答案 0 :(得分:1)

这是 tensorflow 1.3 中的bugfix已被移植到1.4(当然后来也是如此)。您有tensorflow 1.5.0,但不是tensorflow-gpu - 1.3.0。当您从keras运行multi_gpu_model时,显然正在使用tensorflow-gpu操作。

因此,您应该将tensorflow-gpu更新为至少1.4,最新版本会更好。