I have this sample code in file.m (compiled by Objective-C++ compiler) in Xcode iOS project (LibTorch is loaded via Cocoapods):
auto param = torch::tensor({1.}, torch::requires_grad());
auto result = 1 + param;
result.backward();

Executing gives this error:
libc++abi.dylib: terminating with uncaught exception of type c10::Error: Could not run ‘aten::_backward’ with arguments from the ‘CPU’ backend. This could be because the operator doesn’t exist for this backend, or was omitted during the selective/custom build process (if using custom build). If you are a Facebook employee using PyTorch on mobile, please visit https://fburl.com/ptmfixes for possible resolutions. ‘aten::_backward’ is only available for these backends: [BackendSelect, Named, AutogradOther, AutogradCPU, AutogradCUDA, AutogradXLA, Tracer, Autocast, Batched, VmapMode].
I searched a lot and still have no answer, please give any suggestions how can to fix it.