`fork` and `wait` within LibTorch's `torch::jit::compile`

Hi,

I’m seeing the following when trying to fork and wait inside torch::jit::compile from LibTorch. For example, something like:

#include <torch/torch.h>
#include <iostream>

int main() {
  auto compiled = torch::jit::compile(R"|(
def foo (x: Tensor):
    return torch.neg(x)

def hello (x: Tensor):
  future = torch.jit.fork(foo, x)
  x_normal = foo(x)
  x_parallel = torch.jit.wait(future)
  return x_normal, x_parallel
)|");
    return 0;
}

Errors with:

libc++abi: terminating with uncaught exception of type torch::jit::ErrorReport: 
attribute lookup is not defined on builtin:
  File "<string>", line 6

def hello (x: Tensor):
  future = torch.jit.fork(foo, x)
           ~~~~~~~~~~~~~~ <--- HERE
  x_normal = foo(x)
  x_parallel = torch.jit.wait(future)

Is this supposed to work? If not, as I don’t really understand jit internals, it would be nice to understand why this couldn’t work.

Thank you very much