I am trying to add a new function via the ATen’s Native Functions.
However the compilation fails.
Only changes I have done are,
- func: test_fn(Tensor input) -> Tensor
in aten/src/ATen/native/native_functions.yaml
Tensor test_fn(const Tensor & input){
    return at::zeros_like(input);
}

in aten/src/ATen/native/Embedding.cpp
Link 3 to git diff of the changes.
I am adding these to this master 1.
Am I missing something in the process?
This is the error log,
[ 91%] Building CXX object caffe2/torch/CMakeFiles/torch.dir/csrc/autograd/generated/VariableType_0.cpp.o
[ 91%] Building CXX object caffe2/torch/CMakeFiles/torch.dir/csrc/autograd/generated/VariableType_1.cpp.o
[ 91%] Building CXX object caffe2/torch/CMakeFiles/torch.dir/csrc/autograd/generated/VariableType_2.cpp.o
[ 91%] Building CXX object caffe2/torch/CMakeFiles/torch.dir/csrc/autograd/generated/VariableType_3.cpp.o
/home/user/Desktop/Repositories/Pytorch/pytorch_db_back/torch/csrc/autograd/generated/VariableType_0.cpp: In member function ‘virtual at::Tensor torch::autograd::VariableType::test_fn(const at::Tensor&) const’:
/home/user/Desktop/Repositories/Pytorch/pytorch_db_back/torch/csrc/autograd/generated/VariableType_0.cpp:6104:40: error: ‘test_fn’ is not a member of ‘torch::jit::aten’
     node = tracer_state->graph->create(jit::aten::test_fn, /*num_outputs=*/0);
                                        ^~~
/home/user/Desktop/Repositories/Pytorch/pytorch_db_back/torch/csrc/autograd/generated/VariableType_0.cpp:6104:40: note: suggested alternatives:
In file included from /home/user/Desktop/Repositories/Pytorch/pytorch_db_back/aten/src/ATen/ATen.h:13:0,
                 from /home/user/Desktop/Repositories/Pytorch/pytorch_db_back/torch/csrc/autograd/generated/VariableType.h:5,
                 from /home/user/Desktop/Repositories/Pytorch/pytorch_db_back/torch/csrc/autograd/VariableTypeUtils.h:1,
                 from /home/user/Desktop/Repositories/Pytorch/pytorch_db_back/torch/csrc/autograd/generated/VariableType_0.cpp:1:
/home/user/Desktop/Repositories/Pytorch/pytorch_db_back/build/aten/src/ATen/Functions.h:3494:22: note:   ‘at::test_fn’
 static inline Tensor test_fn(const Tensor & input) {
                      ^~~~~~~
/home/user/Desktop/Repositories/Pytorch/pytorch_db_back/build/aten/src/ATen/Functions.h:3494:22: note:   ‘at::test_fn’
In file included from /home/user/Desktop/Repositories/Pytorch/pytorch_db_back/build/aten/src/ATen/Functions.h:12:0,
                 from /home/user/Desktop/Repositories/Pytorch/pytorch_db_back/aten/src/ATen/ATen.h:13,
                 from /home/user/Desktop/Repositories/Pytorch/pytorch_db_back/torch/csrc/autograd/generated/VariableType.h:5,
                 from /home/user/Desktop/Repositories/Pytorch/pytorch_db_back/torch/csrc/autograd/VariableTypeUtils.h:1,
                 from /home/user/Desktop/Repositories/Pytorch/pytorch_db_back/torch/csrc/autograd/generated/VariableType_0.cpp:1:
/home/user/Desktop/Repositories/Pytorch/pytorch_db_back/build/aten/src/ATen/NativeFunctions.h:270:19: note:   ‘at::native::test_fn’
 CAFFE2_API Tensor test_fn(const Tensor & input);
                   ^~~~~~~
[ 91%] Building CXX object modules/detectron/CMakeFiles/caffe2_detectron_ops.dir/roi_pool_f_op.cc.o
caffe2/torch/CMakeFiles/torch.dir/build.make:280: recipe for target 'caffe2/torch/CMakeFiles/torch.dir/csrc/autograd/generated/VariableType_0.cpp.o' failed
make[2]: *** [caffe2/torch/CMakeFiles/torch.dir/csrc/autograd/generated/VariableType_0.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
[ 92%] Building CXX object modules/detectron/CMakeFiles/caffe2_detectron_ops.dir/sample_as_op.cc.o
[ 92%] Building CXX object modules/detectron/CMakeFiles/caffe2_detectron_ops.dir/select_smooth_l1_loss_op.cc.o
[ 92%] Building CXX object modules/detectron/CMakeFiles/caffe2_detectron_ops.dir/sigmoid_cross_entropy_loss_op.cc.o
[ 92%] Building CXX object modules/detectron/CMakeFiles/caffe2_detectron_ops.dir/sigmoid_focal_loss_op.cc.o
[ 92%] Building CXX object modules/detectron/CMakeFiles/caffe2_detectron_ops.dir/smooth_l1_loss_op.cc.o
[ 92%] Building CXX object modules/detectron/CMakeFiles/caffe2_detectron_ops.dir/softmax_focal_loss_op.cc.o
[ 92%] Building CXX object modules/detectron/CMakeFiles/caffe2_detectron_ops.dir/spatial_narrow_as_op.cc.o
[ 92%] Building CXX object modules/detectron/CMakeFiles/caffe2_detectron_ops.dir/upsample_nearest_op.cc.o
[ 92%] Linking CXX shared module python/caffe2_pybind11_state.cpython-37m-x86_64-linux-gnu.so
[ 92%] Built target caffe2_pybind11_state
CMakeFiles/Makefile2:6524: recipe for target 'caffe2/torch/CMakeFiles/torch.dir/all' failed
make[1]: *** [caffe2/torch/CMakeFiles/torch.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 92%] Linking CXX shared library ../../lib/libcaffe2_detectron_ops.so
[ 92%] Built target caffe2_detectron_ops
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2
Failed to run 'bash ../tools/build_pytorch_libs.sh --use-nnpack --use-mkldnn caffe2 libshm gloo c10d THD'

Following is the build config
-- 
-- ******** Summary ********
-- General:
--   CMake version         : 3.12.2
--   CMake command         : /home/user/Desktop/Repositories/Pytorch/Pytorch_EXP_DB_BACK_ENV/bin/cmake
--   System                : Linux
--   C++ compiler          : /usr/bin/c++
--   C++ compiler version  : 6.4.0
--   BLAS                  : MKL
--   CXX flags             : --std=c++11  -Wno-deprecated -fvisibility-inlines-hidden -D_FORCE_INLINES -D_MWAITXINTRIN_H_INCLUDED -D__STRICT_ANSI__ -fopenmp -O2 -fPIC -Wno-narrowing -Wall -Wextra -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-unused-result -Wno-strict-overflow -Wno-strict-aliasing -Wno-error=deprecated-declarations -Wno-error=pedantic -Wno-error=redundant-decls -Wno-error=old-style-cast -Wno-unused-but-set-variable -Wno-maybe-uninitialized
--   Build type            : Release
--   Compile definitions   : ONNX_NAMESPACE=onnx_torch;USE_GCC_ATOMICS=1;TH_BLAS_MKL;HAVE_MMAP=1;_FILE_OFFSET_BITS=64;HAVE_SHM_OPEN=1;HAVE_SHM_UNLINK=1;HAVE_MALLOC_USABLE_SIZE=1
--   CMAKE_PREFIX_PATH     : /home/user/Desktop/Repositories/Pytorch/Pytorch_EXP_DB_BACK_ENV/lib/python3.7/site-packages
--   CMAKE_INSTALL_PREFIX  : /home/user/Desktop/Repositories/Pytorch/pytorch_db_back/torch/lib/tmp_install
-- 
--   TORCH_VERSION         : 1.0.0
--   CAFFE2_VERSION        : 1.0.0
--   BUILD_ATEN_MOBILE     : OFF
--   BUILD_ATEN_ONLY       : OFF
--   BUILD_BINARY          : OFF
--   BUILD_CUSTOM_PROTOBUF : ON
--     Link local protobuf : ON
--   BUILD_DOCS            : OFF
--   BUILD_PYTHON          : ON
--     Python version      : 3.7
--     Python executable   : /home/user/Desktop/Repositories/Pytorch/Pytorch_EXP_DB_BACK_ENV/bin/python
--     Pythonlibs version  : 3.7.0
--     Python library      : /home/user/Desktop/Repositories/Pytorch/Pytorch_EXP_DB_BACK_ENV/lib/libpython3.7m.so.1.0
--     Python includes     : /home/user/Desktop/Repositories/Pytorch/Pytorch_EXP_DB_BACK_ENV/include/python3.7m
--     Python site-packages: lib/python3.7/site-packages
--   BUILD_CAFFE2_OPS      : ON
--   BUILD_SHARED_LIBS     : ON
--   BUILD_TEST            : ON
--   USE_ASAN              : OFF
--   USE_CUDA              : 0
--   USE_ROCM              : OFF
--   USE_EIGEN_FOR_BLAS    : 
--   USE_FFMPEG            : OFF
--   USE_GFLAGS            : OFF
--   USE_GLOG              : OFF
--   USE_LEVELDB           : OFF
--   USE_LITE_PROTO        : OFF
--   USE_LMDB              : OFF
--   USE_METAL             : OFF
--   USE_MKL               : 
--   USE_MOBILE_OPENGL     : OFF
--   USE_NCCL              : OFF
--   USE_NNPACK            : 1
--   USE_NUMPY             : ON
--   USE_OBSERVERS         : ON
--   USE_OPENCL            : OFF
--   USE_OPENCV            : OFF
--   USE_OPENMP            : OFF
--   USE_PROF              : OFF
--   USE_REDIS             : OFF
--   USE_ROCKSDB           : OFF
--   USE_ZMQ               : OFF
--   USE_DISTRIBUTED       : ON
--     USE_MPI             : ON
--     USE_GLOO            : ON
--     USE_GLOO_IBVERBS    : OFF
--   Public Dependencies  : Threads::Threads;caffe2::mkl
--   Private Dependencies : nnpack;cpuinfo;/usr/lib/x86_64-linux-gnu/libnuma.so;fp16;/home/user/Desktop/Repositories/Pytorch/Pytorch_EXP_DB_BACK_ENV/lib/libmpi.so;gloo;aten_op_header_gen;onnxifi_loader;rt;gcc_s;gcc;dl
-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    CUDNN_INCLUDE_DIR
    CUDNN_LIBRARY
    CUDNN_LIB_DIR