概述
Tensorflow反卷积操作中Incompatible shapes between op input and calculated input gradient问题解决办法
- 欢迎使用Markdown编辑器
欢迎使用Markdown编辑器
在编写自编码器网络时需要进行卷积和反卷积操作,在使用tf.nn.conv2d_transpose中遇到了Incompatible shapes between op input and calculated input gradient这个问题,为模式不匹配。在这个反卷积函数中,有一个参数为output_size,定义为输出大小,还有一个参数为滤波器大小。像卷积操作一样,知道输入数据大小、滤波器尺寸大小、步长等等就可以计算出特征图大小。同理反卷积也可以推算出原数据大小的。所以对于反卷积计算有两个:第一个为设置的output_size;第二个是由公式W=(N-1)* S - 2P + F,N
是输入图像大小,s为步长,f为滤波器大小,p为补零。之所以出现Incompatible shapes between op input and calculated input gradient这个问题是由于两个计算出来的结果不相等,因此通过修改S、F等参数使得两个计算结果相等就可以解决这个问题。
最后
以上就是狂野早晨为你收集整理的TensorFlow中出现Incompatible shapes between op input and calculated input gradient欢迎使用Markdown编辑器的全部内容,希望文章能够帮你解决TensorFlow中出现Incompatible shapes between op input and calculated input gradient欢迎使用Markdown编辑器所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复