CUDA Error : CUBLAS_STATUS_INVALID_VALUE

I am trying to import a VCG-16 model from torchvision.models, but while running my code im getting this error

CUDA error: CUBLAS_STATUS_INVALID_VALUE when calling cublasSgemm( handle, opa, opb, m, n, k, &alpha, a, lda, b, ldb, &beta, c, ldc)

Hey @na18b021, welcome to the forum.
Not sure about the error but maybe reducing the batch size might help you.
Follow the below post to know more,

Hey thanks for the reply i figured out the mistake, it was difference in the input features. However im stuck at a new problem now
while using VGG16 model, i am uploading dataloader with size
394 x 3 x 224 x 224
but the model is taking it as a list of like [394,25088] structure

I changed the model and used ResNet pretrained model from torchvision models.
It worked properly without any error there.
Can you tell me why i am facing this issue with VGG16 and not with ResNet

Can you show the code where you were defining the VGG model?

class BrainTumour(ImageClassificationBase):

def __init__(self, num_classes, pretrained=True):

    super().__init__()

    # Use a pretrained model

    self.network = models.vgg16(pretrained=pretrained)

    in_features=self.network.classifier[6].in_features

    features = list(self.network.children())[:-1] # Remove last layer

    features.extend([nn.Linear(in_features,num_classes )]) # Add our layer with 4 outputs

    self.network.classifier=nn.Sequential(*features)

def forward(self, xb):

    return self.network(xb)

This is the main model which i used.
The other functions i used were from the notebooks itself
I used .fc function but came to know that for VGG model that function doesnt exist

Probably you are changing all the classifier layers using self.network.classifier. Use self.network.classifier[6] instead. The below code is a working code on VGG16. (Ignore the comments and check only the __init__ part.

Sir can you explain the freeze and unfreeze functions?

Hey @na18b021, go through this article to know more about freezing in neural networks.

Hello Sir,
I had completed my second week assignment more than a week ago, can you please grade it so i can get the completion certificate.
Thank You

Hey @na18b021, appreciate your patience. We will evaluate all GANS assignment/project within a day.