param.requires_grad = False will “freeze” this parameter, so that no gradient will be calculated for it.
I’m not sure, why you would want to freeze untrained parameters, but there might be specific use cases where this might be used (for experimenting?).