is doing
x = nn.Conv2d(in_channels=1, out_channels=10, kernel_size=1)
x(input_image)

equivalent to what I am asking, also if I want my neural network to learn the size of vectors for each pixel, so one pixel could be represented as 10 sized vector, another pixel could be represented as 20 sized vector, how to do this?
furthermore, if I want to find how each pixel is related to other pixels, represented by a score, and that score is 0, for same pixel, and high for nearby pixels, that differ.
for example, if I have a 20x20 image, with all white pixels, except one pixel which is black, then this score for black pixel with black pixel would be 0, score of black pixel with white pixel would be high, as they are different, similarly score of white pixel with white pixel would be 0, score of white pixel with black pixel would be high, and finally I have a matrix of scores for each pixel, so, black pixel score would be high, as there are lot of white pixels around it, whereas white pixels score would be lower than black pixel.
so for [20x20] sized image, I get [20x20] sized score matrix, and then reduce it to number of classes I have in classification task, let us assume 5, so from [20x20] to 5, these 5 numbers would be probability of what class was predicted based on scores.
the task of neural network would be to learn vector size, and how to represent all of these pixels as vectors.