我正在尝试将具有以下属性的张量写入PNG文件。
type(adv_x)
<class 'tensorflow.python.framework.ops.EagerTensor'>
adv_x.shape
(1, 600, 800, 3)
tf.rank(adv_x)
tf.Tensor(4, shape=(), dtype=int32)
我知道如何将张量显示为图像(plt.imshow(adv_x[0])
,但我想将其写入文件,以便最终得到600 x 800像素的RGB .PNG文件。
提前感谢。