From 6043b7f958b5ff5e7d7c2ff8621267d700ba9263 Mon Sep 17 00:00:00 2001 From: charliebudd Date: Mon, 6 Nov 2023 11:47:10 +0000 Subject: [PATCH] fixed compilation errors on windows --- src/torchcontentarea/csrc/implementation.cpp | 8 ++++---- src/torchcontentarea/csrc/source/find_points_cuda.cu | 2 +- .../csrc/source/find_points_from_scores_cuda.cu | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/torchcontentarea/csrc/implementation.cpp b/src/torchcontentarea/csrc/implementation.cpp index e34becd..957dc4a 100644 --- a/src/torchcontentarea/csrc/implementation.cpp +++ b/src/torchcontentarea/csrc/implementation.cpp @@ -4,7 +4,7 @@ #include "cpu_functions.hpp" #include "cuda_functions.cuh" -#define IMAGE_DTYPE_ERROR_MSG(t) std::string("Unsupported image dtype .").insert(24, torch::utils::getDtypeNames(t).second) +#define IMAGE_DTYPE_ERROR_MSG(t) std::string("Unsupported image dtype .").insert(24, t) #define IMAGE_NDIM_ERROR_MSG(d) std::string("Expected an image tensor with 3 or 4 dimensions but found .").insert(58, std::to_string(d)) #define IMAGE_CHANNEL_ERROR_MSG(c) std::string("Expected a grayscale or RGB image but found size at position 1.").insert(49, std::to_string(c)) #define POINTS_NDIM_ERROR_MSG(d) std::string("Expected a point tensor with 2 or 3 dimensions but found .").insert(52, std::to_string(d)) @@ -31,7 +31,7 @@ void check_image_tensor(torch::Tensor &image) case (torch::kByte): break; case (torch::kInt): break; case (torch::kLong): break; - default: throw std::runtime_error(IMAGE_DTYPE_ERROR_MSG(torch::typeMetaToScalarType(image.dtype()))); + default: throw std::runtime_error(IMAGE_DTYPE_ERROR_MSG(at::toString(image.dtype()))); } } @@ -59,8 +59,8 @@ Image get_image_data(torch::Tensor image) case (torch::kDouble): return Image(is_rgb ? ImageFormat::rgb_double : ImageFormat::gray_double, (void*)image.data_ptr()); case (torch::kByte): return Image(is_rgb ? ImageFormat::rgb_uint8 : ImageFormat::gray_uint8, (void*)image.data_ptr()); case (torch::kInt): return Image(is_rgb ? ImageFormat::rgb_int : ImageFormat::gray_int, (void*)image.data_ptr()); - case (torch::kLong): return Image(is_rgb ? ImageFormat::rgb_long : ImageFormat::gray_long, (void*)image.data_ptr()); - default: throw std::runtime_error(IMAGE_DTYPE_ERROR_MSG(torch::typeMetaToScalarType(image.dtype()))); + case (torch::kLong): return Image(is_rgb ? ImageFormat::rgb_long : ImageFormat::gray_long, (void*)image.data_ptr()); + default: throw std::runtime_error(IMAGE_DTYPE_ERROR_MSG(at::toString(image.dtype()))); } } diff --git a/src/torchcontentarea/csrc/source/find_points_cuda.cu b/src/torchcontentarea/csrc/source/find_points_cuda.cu index b29f0f7..bba2c98 100644 --- a/src/torchcontentarea/csrc/source/find_points_cuda.cu +++ b/src/torchcontentarea/csrc/source/find_points_cuda.cu @@ -188,7 +188,7 @@ namespace cuda best_edge_x = s_cross_warp_operation_buffer[lane_index]; best_edge_score = s_cross_warp_operation_buffer_2[lane_index]; - int next_power_two = pow(2, ceil(log(warp_count)/log(2))); + int next_power_two = pow(2, ceil(logf(warp_count)/logf(2))); #pragma unroll for (int offset = next_power_two >> 1 ; offset > 0; offset >>= 1) diff --git a/src/torchcontentarea/csrc/source/find_points_from_scores_cuda.cu b/src/torchcontentarea/csrc/source/find_points_from_scores_cuda.cu index bf2ec71..1ad3a61 100644 --- a/src/torchcontentarea/csrc/source/find_points_from_scores_cuda.cu +++ b/src/torchcontentarea/csrc/source/find_points_from_scores_cuda.cu @@ -63,7 +63,7 @@ namespace cuda best_edge_x = s_cross_warp_operation_buffer[lane_index]; best_edge_score = s_cross_warp_operation_buffer_2[lane_index]; - int next_power_two = pow(2, ceil(log(warp_count)/log(2))); + int next_power_two = pow(2, ceil(logf(warp_count)/logf(2))); #pragma unroll for (int offset = next_power_two >> 1 ; offset > 0; offset >>= 1)