我正在运行以下代码。我收到XLA Compiler错误,如下所述。我有Tensorflow GPU 1.8版本,但我确实尝试了CPU版本,我收到了错误。但是当我将Tensorflow(CPU)降级到1.3时,我没有收到任何错误。已使用Pip的虚拟环境安装Tensorflow。
请有人帮助我。
代码:
(?, 16, 16, 3)
(?, 8, 8, 6)
(?, 16, 16, 3) # <<<<< This should have printed (?, ?, ?, ?)
Traceback (most recent call last):
File "/my/path/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 2327, in get_attr
c_api.TF_OperationGetAttrValueProto(self._c_op, name, buf)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Operation 'conv2d_transpose' has no attr named '_XlaCompile'.
Traceback (most recent call last):
File "/my/path/lib/python3.6/site-packages/tensorflow/python/ops/gradients_impl.py", line 380, in _MaybeCompile
xla_compile = op.get_attr("_XlaCompile")
File "/my/path/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 2331, in get_attr
raise ValueError(str(e))
ValueError: Operation 'conv2d_transpose' has no attr named '_XlaCompile'.
错误日志:
g = tf.train.AdamOptimizer(0.01).minimize(t)
错误出现在第{{1}}行
中答案 0 :(得分:1)
问题正在发生,因为过滤器的形状不匹配,与之相关的步幅与VALID填充产生所需的输出形状。我应该设置[1,1,3,3]的反卷积滤波器形状,并在[1,1,1,1]处大步前进。
必填代码:
deconv_filter = tf.get_variable('deconv_filter', shape=[1, 1, 6, 3], dtype=tf.float32)
deconv = tf.nn.conv2d_transpose(input_tensor, filter=deconv_filter,
output_shape=tf.shape(input_tensor),
strides=[1, 1, 1, 1],
padding='VALID')