You should still be able to use the posted code to set the learning rate for each parameter group (which could be separate layers):
for (auto param_group : optimizer.param_groups()) {
  static_cast<torch::optim::AdamOptions &>(param_group.options()).lr(new_lr);
}
# or alternatively via the index in the first code snippet