Expression surface:toTensor() returns a torch.Tensor initialized with the RGBA data of the window or image surface surface. This function is not available for PDF and PS surfaces.
surface:toTensor()
torch.Tensor
surface