# Training a torch::jit::script::Module

**URL:** <https://discuss.pytorch.org/t/training-a-torch-module/58512>\
**Category:** jit\
**Created:** [October 17, 2019, 6:34pm UTC](https://discuss.pytorch.org/t/training-a-torch-module/58512 "2019-10-17T18:34:44Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![markl](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/markl/32/16511_2.png) [@markl](https://discuss.pytorch.org/u/markl)\
**Post date:** [October 23, 2019, 7:32pm UTC](https://discuss.pytorch.org/t/training-a-torch-module/58512/5 "2019-10-23T19:32:15Z")

</div>

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.

Maybe you can take a look at what I was trying to do here [jit::script::Module parameters are not updating when training](https://discuss.pytorch.org/t/jit-module-parameters-are-not-updating-when-training/58945/8)

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?

---

_[View the full topic](https://discuss.pytorch.org/t/training-a-torch-module/58512)._
