Are c10::Dicts reference types

I know that torch::jit::Modules are reference types: passing them around to functions / assigning them to variables doesn’t do an expensive copy of the entire model.

Is that also true for torch::Tensor? For c10::Dict and all the other c10 types?

For torch::Tensor and c10::Dict, yes.
For all other c10 types, I don’t have a list on which c10 type copy values and which copy refs/ptrs, I think we can only talk about it type by type.

Hmm thanks for the info. Let’s say I’m interested in c10::Tuple and I want to identify if its a ref type or not. How do I tell?

I am not aware of c10::Tuple in our code base (or do you mean c10::Ivalue::Tuple?) . We do have TupleType and TupleTypePtr.
I assume you use it as an example. Normally, the implementation of these c10 types are located in
c10/utils or aten/src/ATen/core, you can search the implementation there.

If you are talking about Ivalue::Tuple (or any types under Ivalue), take a look at here:
pytorch/ivalue.h at 5741de883af2ac63cec537fc8a554610a5cea853 · pytorch/pytorch · GitHub
If you don’t call deepCopy, I believe there will be no value copy (buy swap) happen.