I haven’t done it myself but openCV has something called a VideoWriter. That should do the trick. There is also the ffmpeg module outside of Python.
The way I have done it in the past saving all the images in a folder and via a bash script and ffmpeg make a movie out of them. Not as clean, but yeah.
Here is a pyimagesearch 28 tutorial of something similar
Edit: Well you’d have to convert your tensor to images beforehand. If you need help with that let us know