Hi @xta0, I realize this conversation is a little old, but am having a similar issue. I tried your suggestion of changing the NO_API value to OFF but when i do I the build fails with the following:
#> BUILD_PYTORCH_MOBILE=1 IOS_PLATFORM=SIMULATOR ./scripts/build_ios.sh
pytorch/csrc/api/src/nn/module.cpp:5:10: fatal error: 'torch/csrc/autograd/generated/VariableType.h' file not found
#include <torch/csrc/autograd/generated/VariableType.h>

Seems someone has had and resolved this issue… here 4 but the resolution was unclear.
Technically I only need torch::nn::functional::pad() might there be a way to include just this limited requirement?