Hey, so It didnt work. Let me repose the problem in a different way:
def train_ewc(train_loader,lamda, fishers, prev_opt_thetas, epoch,description=""):
	# loss_testA, acc_testA = test(testA_loader,description="Test on task A")
	# print()
	# loss_testB, acc_testB = test(testB_loader,description="Test on task B")
	# print()
	base_model.train()


	loss_train = 0
	pbar = tqdm(train_loader)
	pbar.set_description(description)
	# freeze_layers(0, base_model)
	for param in base_model.parameters():
		param.requires_grad = False



	count=0
	for inputs, targets in pbar:
		# for name, param in base_model.named_parameters():
		# 	print(name, param.requires_grad)
		inputs, targets = inputs.to(device), targets.to(device)

		optimizer.zero_grad()
		logits = base_model(inputs)
		cur_thetas = list(base_model.parameters())
		loss_ewc = ewc_loss(logits, targets, lamda, fishers,
							prev_opt_thetas, cur_thetas)

		loss_cross_entropy = base_loss_fn(logits, targets)

		
		total_loss = loss_cross_entropy + loss_ewc
		print(" Total loss is " + str(total_loss)+" EWC loss is " + str(loss_ewc)+" cross entropy  is " + str(loss_cross_entropy))
		loss_train += total_loss.item()
		# total_loss.backward()
		# optimizer.step()

	print("total loss is: ",loss_train )
	loss_train /= len(train_loader)

	loss_testA, acc_testA = test(testA_loader,description="Test on task A")

This is my code, even when I commented out optimizer.step and loss.backward, still my model is changing. How is this possible. I even set require grad of each layer to false, still the model is changing.