TorchVision cannot be used

I want to use some of the registered ops in the TorchVision API now, but when I run the test, I can’t find those OPSs with torch::jit output, e.g. torchvision::roi_align or torchvision::nms; I made sure that torchvision and libtorch versions correspond (torchvision 0.16.1 libtorch2.1.2 + cu121), cuda is 12.1 and I’m sure with_cuda compilation is turned on. Does anyone can help me?

#include “torch/script.h”
#include “torch/torch.h”
#include <torchvision/csrc/ops/roi_align.h>
auto& ops = torch::jit::getAllOperatorsFor(torch::jit::Symbol::fromQualString(“torchvision::roi_align”));
ASSERT_EQ(ops.size(), 1);
This result is
Failure
Expected equality of these values:
ops.size()
Which is: 0
1

My problem has been solved by adding "-Wl,–no-as-needed " in target_link_libraries in CmakeLists of my projection.