RuntimeError: Given groups=1, weight of size [32, 3, 3, 3], expected input[64, 32, 32, 3] to have 3 channels, but got 32 channels instead

username: Maria_Fernanda_De_La
cooked: <p>Not sure how to get only the last three items:</p>
<pre><code class="lang-auto">class MyDataset(Dataset):
    def __init__(self,remove_list):
        self.cifar10 = datasets.CIFAR10(root='./data',

                                        download=False,
                                        train=True,
                                        transform=transform)
        self.data = self.cifar10.data
        
        self.targets = self.cifar10.targets
        self.final_data, self.final_targets = self.__remove__(remove_list)
    
      
    def __getitem__(self, index):
        data, target = self.final_data2[index], self.final_targets[index]
        
        return data, target, index

    def __len__(self):
        return len(self.final_data)

    def __remove__(self, remove_list):
        data = np.delete(self.data, remove_list, axis=0)        
        targets = np.delete(self.targets, remove_list, axis=0)
        
        return data, targets

mydataset = MyDataset([])
trainloader = DataLoader(mydataset, batch_size=254, num_workers=8)
</code></pre>
<pre><code class="lang-auto">
class Net(nn.Module):
    def __init__(self):
        super(Net, self).__init__()
        self.conv_layer1 = nn.Sequential(
            nn.Conv2d(in_channels=3, out_channels=32, kernel_size=3, stride=2),
            nn.BatchNorm2d(32),
            nn.ReLU()
        )
        self.conv_layer2 = nn.Sequential(
            nn.Conv2d(in_channels=32, out_channels=64, kernel_size=3, stride=1),
            nn.BatchNorm2d(64),
            nn.ReLU()
        )

        self.conv_layer3 = nn.Sequential(
            nn.Conv2d(in_channels=64, out_channels=128, kernel_size=3, stride=1),
            nn.BatchNorm2d(128),
            nn.ReLU()
        )

        self.conv_layer4 = nn.Sequential(
            nn.Conv2d(in_channels=128, out_channels=128, kernel_size=3, stride=2),
            nn.BatchNorm2d(128),
            nn.ReLU()
        )

        self.fc_layer = nn.Sequential(
            nn.Linear(25*128,10)
        )
   

    def forward(self, x):
        out = self.conv_layer1(x)
        out = self.conv_layer2(out)
        out = self.conv_layer3(out)
        out = self.conv_layer4(out)
        out = out.reshape(out.size(0), -1)
        out = self.fc_layer(out)
        return out
</code></pre>

username: Maria_Fernanda_De_La
cooked: <p>I think this is right now:</p>
<pre><code class="lang-auto">
class MyDataset(Dataset):
    def __init__(self,remove_list):
        self.cifar10 = datasets.CIFAR10(root='./data',

                                        download=False,
                                        train=True,
                                        transform=transform)
        self.data = self.cifar10.data
        self.transform = transforms.Compose([transforms.ToTensor(),transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))])

        
        self.targets = self.cifar10.targets
        self.final_data, self.final_targets = self.__remove__(remove_list)
    
      
    def __getitem__(self, index):
        data, target = self.final_data[index], self.final_targets[index]

        data = Image.fromarray(data)

        if self.transform is not None:
            data = self.transform(data)
</code></pre>