slot_list_impl<NameValue> is an iterator over the one of a script::Module's internal lists of Parameters/Attributes. Can you elaborate on your use case for constructing one yourself? You should be able to mess with a script::Module by using script::Module::register_parameter to change any parameter value.
I was trying to adapt the training loop to work for torch::jit::script::Module so I needed the same interface that the optimizer expects. However, I realized that it accepts std::vector<at::Tensor>, so I actually don’t have to create slot_list_impl after all.
I think for the code to actually work, I need to use register_parameter or set_parameter to push the updated tensor back into the script::Module after the optimizer has acted on it. Does that sound right? Or could there be a way that the optimizer can update the tensor values in place?