//#include <torch/script.h> // One-stop header.
//#include <torch/csrc/jit/import.h>
//#include <iostream>
//#include <opencv2/opencv.hpp>
//#include <opencv2/core.hpp>
//#include <opencv2/imgcodecs.hpp>
//#include <opencv2/highgui.hpp>
//#include <memory>
//#include <string>
//
//cv::Mat loadImg(std::string path) {
//	auto image = cv::imread(path, cv::ImreadModes::IMREAD_COLOR);
//	cv::Mat image_transfomed = image;
//	return image_transfomed;
//};
//
//
//torch::Tensor preProcess(cv::Mat img_mat) {
//	// BGR2RGB
//	// cv::cvtColor(img_mat, img_mat, cv::COLOR_BGR2RGB);
//
//
//	// convert cv::Mat to at::Tensor (see https://pytorch.org/cppdocs/api/namespace_at.html#namespace-at)
//	torch::Tensor tensor_image = torch::from_blob(img_mat.data, { img_mat.rows, img_mat.cols,3 }, torch::kByte);
//	tensor_image = tensor_image.permute({ 2,0,1 });
//	tensor_image = tensor_image.toType(torch::kFloat);
//	tensor_image = tensor_image.unsqueeze(0).to(at::kCUDA);
//	return tensor_image;
//}
//
//
//void postProcess(at::Tensor output) {
//	output = output.squeeze().detach().permute({ 1, 2, 0 });
//	output = output.clamp(0, 255).to(torch::kU8);
//	output = output.to(torch::kCPU);
//	cv::Mat result_mat(cv::Size(512, 512), CV_8UC3, output.data_ptr());
//	cv::imwrite("result.jpg", result_mat);
//}
//
//int main() {
//
//	// load model
//	torch::NoGradGuard no_grad;
//	torch::jit::script::Module model = torch::jit::load("E:\\project\\ConsoleApplication4\\DASR.pt");
//	model.eval();
//	model.to(at::kCUDA);
//
//	// pre-process
//	cv::Mat image_transfomed = loadImg("4.jpg");
//	torch::Tensor tensor_image = preProcess(image_transfomed, 1);
//
//	//forward
//	at::Tensor output = model.forward({ tensor_image }).toTensor();
//
//	// post-process
//	postProcess(output, 1);
//	return 0;
//}