I think that depends how and where you plan on implementing it.

If it’s in python, just importing it in the __init__.py 5 should do the trick.
If it’s in cpp implemented within pytorch (not aten), then you need to implement it in torch/csrc in the correct file and then it can be added to the torch.xx python namespace by adding it here 4. Note that the function added there will receive PyObject. You can use it to unpack your data and then send them to a C function somewhere else in torch/csrc.
If it’s in cpp inside Aten, I’m less sure. From what I remember they are bound through _C._VariableFunctions. This is created in a templated file here 1 that contains some special functions. The template is filled by functions in this 2 file. The Aten functions are loaded from a declarations yaml file read here 4. This file is in the Aten repo here 2. From there, the cname for each function should be implemented in the libraries for all backend. The ones not implemented won’t be available. For example, the isSetTo method is implemented in TH, THC and THD and referenced in the declaration file as you can see in this search 3.

Note that for the Aten, I followed as I made it so there might be mistakes in it, but that should give you enough pointer to do what you want. Namely adding your method to the Declarations.cwrap file should create the method in torch. (if it actually returns something). Then you just need to add the code in the backend you are interested in.