Converts the current graphics image into a tensor, given a tensor.

If the window size is m x n then the tensor must also be m x n x 1, in which case the image is converted to grey-scale, or else m x n x 3 in which case the RGB components are stored in the third dimension.

Here is a typical example:

	w=gfx.Window();
	w:line(0,0,400,400)
	x=torch.Tensor(w.width,w.height); -- copy contents
	w:toTensor(x) 
	w2=gfx.Window(w.width/2,w.height/2); -- create a smaller window
	w2:blit(x,0.5); -- blit contents to it at half size.