1 | initial version |
The method for utilizing at::_upsample_nearest_exact2d
in libtorch is as follows:
Include the necessary headers:
#include <torch/torch.h>
Create a tensor of input:
torch::Tensor input = torch::rand({1, 1, 2, 2});
Define the desired output size:
torch::IntArrayRef output_size = {3, 3};
Call the at::_upsample_nearest_exact2d
function:
torch::Tensor output = at::_upsample_nearest_exact2d(input, output_size);
The first argument is the input tensor and the second argument is the desired output size.
Use the output:
std::cout << "Input tensor: " << input << std::endl;
std::cout << "Output tensor: " << output << std::endl;
This will print the input and output tensors to the console.