In VGG network, I often saw the neural_style_tutorial
cnn = models.vgg19(pretrained=True).features.to(device).eval()

It will extract VGG features from pre-trained weight. If I train my network on the custom dataset, then to extract my network feature from the trained model. Instead of using pretrained=True, can I use torch.no_grad()?
cnn = my_model.eval()
with torch.no_grad():
     feature = cnn('fc')