| 32 | } |
| 33 | |
| 34 | int main(int argc, char *argv[]) |
| 35 | { |
| 36 | auto b = torch::rand({3,4}); |
| 37 | auto c = torch::rand({3,4}); |
| 38 | std::cout<<b<<c<<b*c<<b/c<<b.mm(c.t()); |
| 39 | auto cat = torch::cat({b,c},1); |
| 40 | auto stack = torch::stack({b,c},1); |
| 41 | std::cout<<b<<c<<cat<<stack; |
| 42 | |
| 43 | //test torch |
| 44 | auto device = torch::Device(torch::kCUDA); |
| 45 | auto model = ConvReluBn(3,4,3); |
| 46 | model->to(device); |
| 47 | auto input = torch::zeros({1,3,12,12},torch::kFloat).to(device); |
| 48 | auto output = model->forward(input); |
| 49 | std::cout<<output<<std::endl; |
| 50 | |
| 51 | //test opencv |
| 52 | cv::Mat image = cv::imread("C:\\Users\\Administrator\\Pictures\\1.jpg"); |
| 53 | cv::Mat M(200, 200, CV_8UC3, cv::Scalar(0, 0, 255)); |
| 54 | if(!M.data) |
| 55 | return 0; |
| 56 | cv::imshow("fff",image); |
| 57 | cv::imshow("ddd",M); |
| 58 | cv::waitKey(0); |
| 59 | cv::destroyAllWindows(); |
| 60 | QApplication a(argc, argv); |
| 61 | MainWindow w; |
| 62 | w.show(); |
| 63 | return a.exec(); |
| 64 | } |