Thanks a lot for your detailed replies @tom and @albanD. I remember digging into the source code in the past and  I will admit that the PyTorch source code structure is really complex and I was not able to extract the parts I wanted . I essentially just wanted the ways to create the tensors and the tensor accessor parts and I would probably go ahead with the CMake solution and let you know how that turns out.  Even though outdated, Since I only want the ways to create and access tensors, the link shared by @albanD might work out too. Thanks a lot for your answers and for helping me out @ptrblck, @tom @albanD.