分享

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

 处女座的程序猿 2021-09-28

成功解决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) 

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

    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多