get model layer by name pytorch code example Example: how to get pytroch model layer name for name, layer in model.named_modules(): print(name, layer)