You could be able to iterate the parameters and set their requires_grad attribute to False.
Something like this would work where module is the desired layer:
for (auto& parameter : module->parameters()) {
  parameter.requires_grad_(false);
}