thanks for your attention,I have done this bug, the error cause by the coding, the right way to call the function is this way:
std::cout << test << std::endl;
//torch::upsample_nearest1d(test, { 20 });
std::cout << torch::upsample_bilinear2d(test, { 2,20 }, true) << std::endl;