I put up an end-to-end example 45 that should help. The dict construction in C++ can be found here 12. Please follow up if anything is still unclear.
For your other question, we don’t support that yet but it shouldn’t take too long to add, you can track it here: https://github.com/pytorch/pytorch/issues/18286 17