Unknown builtin op: torch_cluster::fps


I’d like to load a TorchScript model trained with Python and which uses 4 libs: pytorch-geometric, pytorch-scatter, pytorch-sparse and pytorch-cluster. The export part is ok and now I want to load the .pt model on C++. The problem is that some operators are unknown. I’ve managed to install C++ APIs of pytorch-scatter, pytorch-sparse and pytorch-cluster and I want to link these libs to my C++ project. I succeed for pytorch-scatter, pytorch-sparse and naively though that I should proceed similarly for pytorch-cluster. But this doesn’t work and I don’t know how to proceed.

Here are the CMakeLists.txt and my application code.


cmake_minimum_required(VERSION 3.0 FATAL_ERROR)

find_package(TorchSparse REQUIRED)
find_package(TorchScatter REQUIRED)
find_package(TorchCluster REQUIRED)

add_executable(example-app example-app.cpp)

target_compile_features(example-app PUBLIC cxx_range_for)
target_link_libraries(example-app TorchSparse::TorchSparse)
target_link_libraries(example-app TorchScatter::TorchScatter)
target_link_libraries(example-app TorchCluster::TorchCluster)

set_property(TARGET example-app PROPERTY CXX_STANDARD 14)


#include <torch/script.h> // One-stop header.
#include <torchsparse/sparse.h>
#include <torchscatter/scatter.h>
#include <torchcluster/cluster.h>
#include <iostream>
#include <memory>

int main(int argc, const char* argv[]) {
  if (argc != 2) {
    std::cerr << "usage: example-app <path-to-exported-script-module>\n";
    return -1;

  torch::jit::script::Module module;
  try {
    // Deserialize the ScriptModule from a file using torch::jit::load().
    module = torch::jit::load(argv[1]);
  catch (const c10::Error& e) {
      std::cerr << e.what();
    std::cerr << "error loading the model\n";
    return -1;

  std::cout << "ok\n";

When I execute the application I got the following error:

Unknown builtin op: torch_cluster::fps.
Could not find any similar ops to torch_cluster::fps. This op may not exist or may not be currently supported in TorchScript.

Do you have any ideas about how I can resolve my problem please?