How to convert coordinate to image with tensor API

Suppose I have n points, represented as tensor(n, 2), the second dimension is coordinate, such as (x, y). I want to convert it to image, represented as (W, H, 1), the first and second dimension represent width and height of the image, and the third dimension is channel.
Now I use opencv to imwrite the points and imread the image, but I want to realize it with only tensor operation , Can you help me ,thx