def networkselect(opt):
    """
    Selection function for available networks.

    Args:
        opt: argparse.Namespace, contains all training-specific training parameters.
    Returns:
        Network of choice
    """
    if opt.arch == "resnet50":
        network = ResNet50(opt)
    else:
        raise Exception("Network {} not available!".format(opt.arch))

    if opt.resume:
        weights = torch.load(
            os.path.join(opt.save_path, opt.resume), weights_only=False
        )
        weights_state_dict = weights["state_dict"]

        if torch.cuda.device_count() > 1:
            encoder_state_dict = OrderedDict()
            for k, v in weights_state_dict.items():
                k = k.replace("module.", "")
                encoder_state_dict[k] = v

            network.load_state_dict(encoder_state_dict)
        else:
            network.load_state_dict(weights_state_dict)

    # print("=================== network =======================")
    # for parameter in network.parameters():
    #     parameter.requires_grad = False
    # for parameter in network.layer_blocks[-1].parameters():
    #     parameter.requires_grad = True

    return network

    Selection function for available networks.

    Args:
        opt: argparse.Namespace, contains all training-specific training parameters.
    Returns:
        Network of choice
    
examples/pytorch/hilander/PSS/Smooth_AP/src/netlib.py