Visualize PyTorch GPU arrays directly without copying them from GPU to main memory and back

I’d like to visualize a PyTorch array (for example an RGB image that is the output of a neural network) that is in GPU memory.

The array changes very often, I want to see it “live”, with little latency and with high frame rate.

Usually I copy it from GPU memory to main memory and then visualize it (i.e. then the image usually goes back to GPU memory in order to be visualized, as far as I know). This copying back and forth creates unnecessary overhead.

Can I instead allow PyTorch to write directly to some graphics buffer? Or at least fetch the data from PyTorch to a graphics buffer (i.e. GPU to GPU, instead of GPU to main memory to GPU)?

An example application is the usage of neural networks for effects/filters for games, screensavers, interactive art installations, live previews in image and video editing, …