What values does torch.Conv2D return?
x = torch.randn(3,64,161,161)\
model = nn.Conv2d(64, 1, kernel_size=1) result = model(x)\
print(result.shape)


output : 3, 1, 161, 161

Output has the first two values as 3 and 1. I understood it as :
3 means the number of input channels that the model has initially received.
1 means the number of output channels after the model dealt with the tensor.
Did I understand correctly?

No, the number of input channels is 64 (the number of output channels is 1). 3 is the batch size in your code snippet.
The convention PyTorch uses for all tensors with 2D multi-channel data is to have shape [N,C,H,W] where

N is batch dimension
C is channel dimension
H is height dimension
W is width dimension

For Conv2d
N will be the same for both the input and output tensors since each batch element in the input tensor produces one corresponding element in the output tensor.
The input tensor's C must be equal to in_channels. This is the first argument you provided to Conv2d. In your case it is 64 so you need to have an input tensor with 64 channels.
The output tensor's C will be equal to out_channels. This is the second argument you provide to Conv2d. In your case it is 1 so the output tensor will have 1 channel.
W and H are the width and height of the data that is being convolved. The output shape will vary depending on the kernel_size, padding, stride, and dilation arguments of Conv2d. The equation relating input W and H to output W and H is

For more information I recommend you check the official documentation.
