Adam optimizer to train model via libtorch C++ on Android


I am building libtorch using ./scripts/

We need the support for Aten Ops and TorchScript, so building without the BUILD_CAFFE2_MOBILE option.

The build is successful, but the library does not link ${TORCH_SRC_DIR}/csrc/api/src/optim/adam.cpp and dependencies because of NO_API being set for Mobile Builds.

Because of this I am unable to train the model and instantiate Adam Optimizer instance from the code.

torch::optim::Adam optimizer_eval(parameters, /lr=/lr); // Gives Linker Errors
optimizer_eval.step(); //Linker Error

Using recent master commit of pytorch : bfa94487b968ccb570ef8cd9547029b967e76ed0

Can someone please help with this ?