天天看点

成功解决TypeError: Value passed to parameter 'paddings' has DataType float32 not in list of allowed valu

解决问题

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

解决思路

类型错误:传递给参数“paddings”的值,不包含允许的值列表中的数据类型, int32, int64,这两种类型

对类型进行转换:强制转换为int类型

解决方法

建议采用np的int类型转换!

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)

哈哈,成功运行,大功告成!

继续阅读