@freezek,  the implementation for certain libtorch classes are not strictly contained in single cpp file. You might need to copy all implementation files to complete MyAdam. If you want to do this kind of copying, you have to search the files realted to Adam in the source code level (directly downloaded from pytorch github codebase), instead of searching Adam implementation in distributed libtorch version, cause distributed version already compiles some Adam class implementation, and you cannot access those.