seems like TopPoolFunction is a autograd function, we don’t support script autograd Functions, so it is not scriptable.
If you want to script it, you will need to write your TopPool function in python or TorchScript in order for TorchScript to compile it(TorchScript can only compile python, not C++),