我有以下问题:
我有Tensor Tensor("content_vgg/conv1_1/Relu:0", shape=(1, 224, 224, 64), dtype=float32, device=/device:CPU:0)
我希望将其保存为图片,但无论我尝试做什么,都会出现InvalidArgumentError: You must feed a value for placeholder tensor 'Placeholder' with dtype float and shape [1,224,224,3]
[[Node: Placeholder = Placeholder[dtype=DT_FLOAT, shape=[1,224,224,3], _device="/job:localhost/replica:0/task:0/device:CPU:0"]()]]
错误
这是我的代码,我已经尝试添加占位符,但即使这样也无法运行
self.conv1_1 = self.conv_layer(bgr, "conv1_1")
print(self.conv1_1)
x = tf.placeholder_with_default(input=self.conv1_1,shape=[1,224,224,64], name='x')
images = tf.reshape(tf.cast(x, tf.uint8), [224, 224, 64])
images_encode = tf.image.encode_jpeg(images)
fname = tf.constant('test.jpeg')
fwrite = tf.write_file(fname, images_encode)
self.sess.run(fwrite)`
有人可以帮助我或给我一个建议,还是让我知道如何用其他解决方案将Tensor保存为图像?