Rewriting this without using libtorch

I want to rewrite this without using libtorch

  torch::Tensor pred_masks = torch::nn::functional::interpolate(
      masks.index({scores_mask, torch::indexing::Ellipsis}),
      torch::nn::functional::InterpolateFuncOptions().size(
          std::vector<int64_t>({input_height_, input_width_})));

in which masks and scores_mask are both tensors.
I don’t want to use libtorch because the library introduces great space cost (more than 4GB for the GPU version) to my project, but I dont know how to rewrite the functions such as the torch::nn::functional::InterpolateFuncOptions() and .index by using pointers like float *
anyone has ideas about it?