there will be an error on while I m putting model.avgpool this?
i.e out of memory
self.model = models.resnet50()
        self.model.avgpool = nn.AdaptiveAvgPool2d(self.model.fc.out_features)

        self.model.fc = nn.Linear(in_features=self.model.fc.in_features, out_features=self.output_classes)

train the model
                for epoch in range(num_epochs):

                    # set the model in train mode

                    self.model.train() 

                    self.model.optimizer.zero_grad()                     

                    # training_input_data = training_input_data.resize_([training_batch_size, 3, 224, 224])

                    training_ground_truth = training_ground_truth.resize_([training_batch_size])

                    self.model = self.model.double()

                    outputs = self.model(training_input_data.double())      

                    sm=torch.nn.Softmax()

                    probabilities=sm(outputs)

                    print("predicted probabilities while testing",probabilities) 

                    loss = self.model.criterion(outputs, training_ground_truth.long())

                    loss.backward()

                    self.model.optimizer.step()

                    train_losses.append(loss.item())