I was in trouble because I couldn’t find an API when I wanted to interpolate with C ++. I was more intuitive and easy to use upsample_bilinear2d in API library near interpolate.
at::Tensor masks_a = at::upsample_bilinear2d(masks.unsqueeze(0), {img_size, img_size}, false);