I have gray scale image dataset. This is my code,
class CNNModel(nn.Module):
    def __init__(self):
        super(CNNModel,self).__init__()
        #Convo 1
        self.cnn1=nn.Conv2d(in_channels=1,out_channels=16,kernel_size=5,stride=1,padding=2)
        self.relu1=nn.ReLU()
        #Maxpool_1
        self.maxpool1=nn.MaxPool2d(kernel_size=2)
        #Convo_2
        self.cnn2=nn.Conv2d(in_channels=16,out_channels=32,kernel_size=5,stride=1,padding=2)
        self.relu2=nn.ReLU()
        self.maxpool2=nn.MaxPool2d(kernel_size=2)
        self.fc1=nn.Linear(32*16*16,2)
    def forward(self,x):
        #Convo_1
        out=self.cnn1(x)
        out=self.relu1(out)
        #Max_pool1
        out=self.maxpool1(out)
        #Convo_2
        out=self.cnn2(out)
        out=self.relu2(out)
        out=self.maxpool2(out)
        out=out.view(out.size(0),-1)#Flattening out 
        out=self.fc1(out)
        return out

Iam getting,
RuntimeError                              Traceback (most recent call last)
<ipython-input-159-7279b8172617> in <module>
      5         labels=Variable(labels)
      6         optimizer.zero_grad()
----> 7         outputs=model(img)
      8         loss=criterion(outputs,labels)
      9         loss.backward()

~\Anaconda3\lib\site-packages\torch\nn\modules\module.py in __call__(self, *input, **kwargs)
    489             result = self._slow_forward(*input, **kwargs)
    490         else:
--> 491             result = self.forward(*input, **kwargs)
    492         for hook in self._forward_hooks.values():
    493             hook_result = hook(self, input, result)

<ipython-input-154-0291a955352f> in forward(self, x)
     14     def forward(self,x):
     15         #Convo_1
---> 16         out=self.cnn1(x)
     17         out=self.relu1(out)
     18         #Max_pool1

~\Anaconda3\lib\site-packages\torch\nn\modules\module.py in __call__(self, *input, **kwargs)
    489             result = self._slow_forward(*input, **kwargs)
    490         else:
--> 491             result = self.forward(*input, **kwargs)
    492         for hook in self._forward_hooks.values():
    493             hook_result = hook(self, input, result)

~\Anaconda3\lib\site-packages\torch\nn\modules\conv.py in forward(self, input)
    299     def forward(self, input):
    300         return F.conv2d(input, self.weight, self.bias, self.stride,
--> 301                         self.padding, self.dilation, self.groups)
    302 
    303 

RuntimeError: Given groups=1, weight[16, 1, 5, 5], so expected input[100, 3, 64, 64] to have 1 channels, but got 3 channels instead

Please tell me where I went wrong