import numpy as np
import torch
import torchvision.transforms as transforms
from sklearn.linear_model import LogisticRegression
import random

def setup_seed(seed):
    torch.manual_seed(seed)
    torch.cuda.manual_seed_all(seed)
    np.random.seed(seed)
    random.seed(seed)
    torch.backends.cudnn.deterministic = True


def test(novel_loader, model, params):
    iter_num = len(novel_loader) 
    acc_all_LR = []
    with torch.no_grad():
        for i, (x, _) in enumerate(novel_loader):
            x_query = x[:, params.n_support:, :, :, :].contiguous().view(params.n_way * params.n_query, *x.size()[2:]).cuda() 
            x_support = x[:, :params.n_support, :, :, :].contiguous().view(params.n_way * params.n_support, *x.size()[2:]).cuda()  # (25, 3, 224, 224)

            if params.use_random_crops:
                # Create random crops of the support set
                crop_support = []
                for img in x_support:
                    crops = []
                    for _ in range(4):
                        transform = transforms.RandomCrop(params.image_size)
                        random_crop = transform(img)
                        crops.append(random_crop)
                    crops.append(img)  # Include the complete image from the support set
                    crop_support.extend(crops)
                crop_support = torch.stack(crop_support)
            else:
                crop_support = x_support

            out_support = model(crop_support)  # (way*shot*5, 512)
            out_query = model(x_query)  # (way*query, 512)

            beta = 0.5
            out_support = torch.pow(out_support, beta) 
            out_query = torch.pow(out_query, beta) 

            _, c = out_support.size()

            out_support_LR_with_GC = out_support.cpu().numpy()
            out_query_LR_with_GC = out_query.cpu().numpy()
            y = np.tile(range(params.n_way), params.n_support)
            y.sort()

            # Perform logistic regression for each random crop
            classifiers = []
            for _ in range(4):
                classifier = LogisticRegression(max_iter=1000).fit(X=out_support_LR_with_GC, y=y)
                classifiers.append(classifier)

            # Perform logistic regression for the complete support set
            complete_classifier = LogisticRegression(max_iter=1000).fit(X=out_support_LR_with_GC, y=y)

            avg_pred = None
            for j, classifier in enumerate(classifiers):
                pred = classifier.predict(out_query_LR_with_GC)
                pred = pred.reshape(params.n_query, params.n_way, -1).astype(np.float64)  # Reshape pred and convert to float64
                if i == 0:
                    avg_pred = pred  # Initialize avg_pred with the first pred values
                else:
                    avg_pred += pred.mean(axis=2)  # Average predictions along the third dimension

# Rest of the code remains the same...
# ...

            # Perform logistic regression for the complete support set
            complete_pred = complete_classifier.predict(out_query_LR_with_GC)
            complete_pred = complete_pred.reshape(params.n_query, params.n_way, -1)  # Reshape pred to (n_query, way, 5)
            avg_pred += complete_pred.mean(axis=2).astype(np.float64)  # Average predictions along the third dimension

            gt = np.repeat(range(params.n_way), params.n_query)
            gt = torch.from_numpy(gt.astype(np.float64)).cuda()

            acc_LG = np.mean(avg_pred.argmax(axis=1) == gt) * 100.
            acc_all_LR.append(acc_LG)

    acc_all = np.asarray(acc_all_LR)
    acc_mean = np.mean(acc_all)
    acc_std = np.std(acc_all)
    print('acc: %4.2f%% +- %4.2f%%' % (acc_mean, 1.96 * acc_std / np.sqrt(iter_num)))


if __name__ == '__main__':
    params = parse_args_test()
    setup_seed(params.seed)

    datamgr = test_dataset.Eposide_DataManager(data_path=params.current_data_path, num_class=params.current_class, image_size=params.image_size, n_way=params.n_way, n_support=params.n_support, n_query=params.n_query, n_eposide=params.test_n_eposide)
    novel_loader = datamgr.get_data_loader(aug=False)
    model = ResNet10.ResNet(list_of_out_dims=params.list_of_out_dims, list_of_stride=params.list_of_stride, list_of_dilated_rate=params.list_of_dilated_rate)

    # test for pretraining model
    tmp = torch.load(params.pretrain_model_path)
    state = tmp['state']
    model.load_state_dict(state)
    model.cuda()
    model.eval()
    test(novel_loader, model, params)

    # test for our method
    tmp = torch.load(params.model_path)
    state_model = tmp['state_model']
    model.load_state_dict(state_model)
    model.cuda()
    model.eval()
    test(novel_loader, model, params)


i am running the file using this command:!python /content/LDP-Net/test_1.py --n_support 1 --seed 1111 --current_data_path /content/2750 --current_class 10 --test_n_eposide 600 --model_path /content/LDP-Net/checkpoint/100.tar --use_random_crops


but i am getting this error:

Traceback (most recent call last):
  File "/content/LDP-Net/test_1.py", line 135, in <module>
    test(novel_loader, model, params)
  File "/content/LDP-Net/test_1.py", line 108, in test
    avg_pred += pred.mean(axis=2)  
numpy.core._exceptions._UFuncOutputCastingError: Cannot cast ufunc 'add' output from dtype('float64') to dtype('int64') with casting rule 'same_kind'


modify the code with required changes and return the modified code