I would recommend providing a minimum working example (MWE)
as a Colab Notebook in a Github Gist. Then people can quickly reproduce the problem.
Also,



 krishna511:

scores_train = []
scores_test = []


epoch = 0
while epoch < n_epoch:
    print('epoch: ', epoch)
    # SHUFFLING
    random_perm = np.random.permutation(x_train.shape[0])
    mini_batch_index = 0
    while True:
        # MINI-BATCH
        indices = random_perm[mini_batch_index:mini_batch_index + 128]
        model.partial_fit(x_train[indices], y_train[indices], classes=7)
        mini_batch_index += 128

        if mini_batch_index >= x_train.shape[0]:
            break

    # SCORE TRAIN
    scores_train.append(model.score(x_train, y_train))

    # SCORE TEST
    scores_test.append(model.score(x_test, y_test))

    epoch += 1



You don’t have to do this manually. You could use from torch.utils.data import DataLoader and drop the last batch. Something like this:
train_set = VisionDataset(root=path, train=True, download=True, transform=transform)
train_loader = DataLoader(train_set, batch_size, drop_last=True, shuffle=True, num_workers=num_workers, pin_memory=True)

Then, for training a epoch, you can do something like:
for inputs, labels in train_loader:
    inputs, labels = inputs.to(self._device), labels.to(self._device)
    ...