def METHOD_NAME(tensor):
    from PIL import Image
    import io
    tensor = np.stack((tensor, tensor, tensor), axis=2)
    height, width, channels = tensor.shape
    image = Image.fromarray(tensor)
    output = io.BytesIO()
    image.save(output, format='PNG')
    image_string = output.getvalue()
    output.close()
    return tf.Summary.Image(height=height,
                            width=width,
                            colorspace=channels,
                            encoded_image_string=image_string)