Yes，I imported torch before loading extension，my code：
import torch

torch.ops.load_library("/home/example_app/build/warp_perspective/libwarp_perspective.so")


@torch.jit.script
def compute(x, y):
    if bool(x[0][0] == 42):
        z = 5
    else:
        z = 10
    x = torch.ops.my_ops.warp_perspective(x, torch.eye(3))
    return x.matmul(y) + z


print(compute.graph)
print(compute(torch.randn(4, 8), torch.randn(8, 5)))

compute.save("example.pt")

I got this error when running python script.py：
(base) root@1b05a3dbfb17:/home# python script.py
Traceback (most recent call last):
  File "script.py", line 3, in <module>
    torch.ops.load_library("/home/example_app/build/warp_perspective/libwarp_perspective.so")
  File "/root/local/miniconda/lib/python3.7/site-packages/torch/_ops.py", line 106, in load_library
    ctypes.CDLL(path)
  File "/root/local/miniconda/lib/python3.7/ctypes/__init__.py", line 364, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: /home/example_app/build/warp_perspective/libwarp_perspective.so: undefined symbol: _ZN3c104impl24ExcludeTensorTypeIdGuardD1Ev