diff --git a/pytorch3d/csrc/pulsar/cuda/commands.h b/pytorch3d/csrc/pulsar/cuda/commands.h index 77bf479c..a7a038bd 100644 --- a/pytorch3d/csrc/pulsar/cuda/commands.h +++ b/pytorch3d/csrc/pulsar/cuda/commands.h @@ -208,7 +208,9 @@ __device__ static float atomicMin(float* address, float val) { #define IABS(a) abs(a) // Checks. -#define ARGCHECK TORCH_CHECK_ARG +// like TORCH_CHECK_ARG in PyTorch > 1.10 +#define ARGCHECK(cond, argN, ...) \ + TORCH_CHECK(cond, "invalid argument ", argN, ": ", __VA_ARGS__) // Math. #define NORM3DF(x, y, z) norm3df(x, y, z) diff --git a/pytorch3d/csrc/pulsar/host/commands.h b/pytorch3d/csrc/pulsar/host/commands.h index 6384969d..997c410d 100644 --- a/pytorch3d/csrc/pulsar/host/commands.h +++ b/pytorch3d/csrc/pulsar/host/commands.h @@ -155,7 +155,9 @@ INLINE void ATOMICADD_F3(T* address, T val) { #define IABS(a) abs(a) // Checks. -#define ARGCHECK TORCH_CHECK_ARG +// like TORCH_CHECK_ARG in PyTorch > 1.10 +#define ARGCHECK(cond, argN, ...) \ + TORCH_CHECK(cond, "invalid argument ", argN, ": ", __VA_ARGS__) // Math. #define NORM3DF(x, y, z) sqrtf(x* x + y * y + z * z) diff --git a/pytorch3d/csrc/pulsar/pytorch/renderer.cpp b/pytorch3d/csrc/pulsar/pytorch/renderer.cpp index 18347595..39f07c3b 100644 --- a/pytorch3d/csrc/pulsar/pytorch/renderer.cpp +++ b/pytorch3d/csrc/pulsar/pytorch/renderer.cpp @@ -17,6 +17,12 @@ #include #endif +#ifndef TORCH_CHECK_ARG +// torch <= 1.10 +#define TORCH_CHECK_ARG(cond, argN, ...) \ + TORCH_CHECK(cond, "invalid argument ", argN, ": ", __VA_ARGS__) +#endif + namespace PRE = ::pulsar::Renderer; namespace pulsar {