Grangeat-based 2D/3D image registration
Loading...
Searching...
No Matches
Global.h
Go to the documentation of this file.
1
6#pragma once
7
8#include <torch/extension.h>
9
10#ifdef __CUDACC__
11#include <cuda.h>
12#include <cuda_runtime.h>
13#else
17#define __host__
18
22#define __device__
23#endif
24
25namespace reg23 {
26
39template <typename T> __host__ __device__ T Square(const T &x) { return x * x; }
40
48template <typename T> __host__ __device__ T Modulo(const T &x, const T &y) { return (x % y + y) % y; }
49
50
51template <typename T> __host__ __device__ T Sign(const T &x) { return static_cast<T>((x > 0) - (x < 0)); }
52
57} // namespace reg23
#define __host__
Definition Global.h:17
#define __device__
Definition Global.h:22
__host__ __device__ T Sign(const T &x)
Definition Global.h:51
__host__ __device__ T Modulo(const T &x, const T &y)
Modulo operation that respect the sign.
Definition Global.h:48
__host__ __device__ T Square(const T &x)
Returns the square of the given value.
Definition Global.h:39
Definition GridSample3DCPU.cpp:6