
Traceback (most recent call last): file "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/tensor_shape.py",line 579,in merge_with new_dims.append(dim.merge_with(other[i])) file "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/tensor_shape.py",line 138,in merge_with self.assert_is_compatible_with(other) file "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/tensor_shape.py",line 111,in assert_is_compatible_with other))ValueError: Dimensions 5 and 4 are not compatibleDuring handling of the above exception,another exception occurred:Traceback (most recent call last): file "/usr/local/lib/python3.5/dist-packages/tensorflow/python/ops/gradIEnts_impl.py",line 602,in gradIEnts in_grad.set_shape(t_in.get_shape()) file "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/ops.py",line 407,in set_shape self._shape = self._shape.merge_with(shape) file "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/tensor_shape.py",line 582,in merge_with raise ValueError("Shapes %s and %s are not compatible" % (self,other))ValueError: Shapes (?,5,15,1) and (?,4,1) are not compatibleDuring handling of the above exception,another exception occurred:Traceback (most recent call last): file "experiment.py",line 65,in <module> batches_per_lot=batches_per_lot,sigma=dp_sigma,dp=dp) file "/home/srikrishna/Research/RGAN_kinect/RGAN_forecasting/model.py",line 247,in GAN_solvers G_solver = tf.train.AdamOptimizer().minimize(G_loss_mean_over_batch,var_List=generator_vars) file "/usr/local/lib/python3.5/dist-packages/tensorflow/python/training/optimizer.py",line 343,in minimize grad_loss=grad_loss) file "/usr/local/lib/python3.5/dist-packages/tensorflow/python/training/optimizer.py",line 414,in compute_gradIEnts colocate_gradIEnts_with_ops=colocate_gradIEnts_with_ops) file "/usr/local/lib/python3.5/dist-packages/tensorflow/python/ops/gradIEnts_impl.py",line 609,in gradIEnts % (op.name,i,t_in.shape,in_grad.shape))ValueError: Incompatible shapes between op input and calculated input gradIEnt. Forward operation: generator/conv2d_transpose_1. input index: 2. Original input shape: (?,1). Calculated input gradIEnt shape: (?,1) 我试图使用一些卷积和conv2d_transpose.在最小化 *** 作期间,错误来自conv2d_transpose层.不确定它为什么会发生.以下是我构建网络的方法:
deconv1 = tf.nn.Conv2d_transpose(output_3d,tf.get_variable('DW1',shape=[4,1,1],initializer=tf.random_normal_initializer()),strIDes=[1,2,3,output_shape=[-1,1]) de_relu1 = tf.nn.relu(deconv1,'de_relu1')deconv2 = tf.nn.Conv2d_transpose(de_relu1,tf.get_variable('DW2',shape=[5,20,75,1]) de_relu2 = tf.nn.relu(deconv2,'de_relu2') 我正在使用tensorflow 1.4.1
解决方法 好吧,事实证明我是以错误的方式解释错误.问题是我给deconv2的输出形状是不正确的.由于conv2d_transpose在张量流中的实现方式,因此在前向传播步骤中完成了conv2d_transpose的形状验证.将步幅= [1,1]改为strIDes = [1,1]使其工作正常.
总结以上是内存溢出为你收集整理的python-3.x – 在最小化AdamOptimizer时,在op输入和计算输入渐变之间获得不兼容的形状全部内容,希望文章能够帮你解决python-3.x – 在最小化AdamOptimizer时,在op输入和计算输入渐变之间获得不兼容的形状所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)