Value passed to parameter 'paddings' has DataType float32 not in list of allowed values: int32, int6

在这个卷积层出错:
这里写图片描述

错误信息:
TypeError: Value passed to parameter ‘paddings’ has DataType float32 not in list of allowed values: int32, int64

解决方法:

import numpy as np
x_padded = tf.pad(x, [[0, 0], [np.int(kernel / 2), np.int(kernel / 2)], [np.int(kernel / 2), np.int(kernel / 2)], [0, 0]], mode=mode)

原因:可能是tensorFlow版本不同,新版本的tf对数据格式要求更为严格。

猜你喜欢

转载自blog.csdn.net/czp_374/article/details/81193185
今日推荐