We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c93a047 commit caa4d0dCopy full SHA for caa4d0d
1 file changed
demos/video/cvutil.hpp
@@ -86,12 +86,13 @@ cv::Mat to_mat(torch::Tensor &tensor) {
86
87
int height = tensor.size(2);
88
int width = tensor.size(3);
89
- auto t = tensor.squeeze()
+ auto t = tensor
90
+ .mul(255)
91
+ .squeeze()
92
.detach()
93
.permute({1, 2, 0})
94
.contiguous()
95
.to(torch::kUInt8)
- .mul(255)
96
// .clamp(0, 255)
97
.clone()
98
.to(torch::kCPU);
@@ -113,7 +114,7 @@ cv::Mat to_mat(torch::Tensor &tensor) {
113
114
115
torch::Device get_default_device() {
116
if (torch::mps::is_available()) {
- // default_device = torch::Device(torch::kMPS);
117
+ default_device = torch::Device(torch::kMPS);
118
std::cout << "[INFO] Running on MPS" << std::endl;
119
} else {
120
std::cout << "[INFO] MPS not available, falling back to CPU" << std::endl;
0 commit comments