You need to define more specifically what you want. When you say a “module”, do you mean things in nn.* like linear layers nn.Linear, conv layers nn.Conv*d, upsampling nn.Upsample, nonlinearities, etc.? Or do you mean PyTorch Functions, which are the real fundamental ops of the computation graph, e.g. view, thnn_convolution, svd, transpose, matmul, etc. Each of the former class is usually implemented with one or more Functions from the latter class, so you need to be clear what your notion of n-th “module” means. If you are referring to the former class, which is probably more reasonable because they are higher-level and more intuitive, there is another difficulty. People can write models using lower-level Functions, e.g. instead of using nn.Linear they use a transpose + addmm, use functions, such as linalg ops including trtrs and potrs, which do not have the corresponding notion of a higher level nn.* module.