23 py::array
IouBevCPU(py::array boxes_a, py::array boxes_b) {
28 int64_t num_a = boxes_a_tensor.
GetLength();
34 int64_t num_b = boxes_b_tensor.
GetLength();
47 py::array
Iou3dCPU(py::array boxes_a, py::array boxes_b) {
52 int64_t num_a = boxes_a_tensor.
GetLength();
58 int64_t num_b = boxes_b_tensor.
GetLength();
71 #ifdef BUILD_CUDA_MODULE
72 py::array IouBevCUDA(py::array boxes_a, py::array boxes_b) {
78 int64_t num_a = boxes_a_tensor.
GetLength();
84 int64_t num_b = boxes_b_tensor.
GetLength();
86 core::Tensor iou_tensor = core::Tensor(
90 IoUBevCUDAKernel(boxes_a_tensor.
GetDataPtr<
float>(),
92 iou_tensor.GetDataPtr<
float>(), num_a, num_b);
96 py::array Iou3dCUDA(py::array boxes_a, py::array boxes_b) {
97 core::Device cuda_device(
"CUDA:0");
98 core::Tensor boxes_a_tensor =
102 int64_t num_a = boxes_a_tensor.GetLength();
104 core::Tensor boxes_b_tensor =
108 int64_t num_b = boxes_b_tensor.GetLength();
110 core::Tensor iou_tensor = core::Tensor(
111 {boxes_a_tensor.GetLength(), boxes_b_tensor.GetLength()},
114 IoU3dCUDAKernel(boxes_a_tensor.GetDataPtr<
float>(),
115 boxes_b_tensor.GetDataPtr<
float>(),
116 iou_tensor.GetDataPtr<
float>(), num_a, num_b);
122 m_contrib.def(
"iou_bev_cpu", &
IouBevCPU,
"boxes_a"_a,
"boxes_b"_a);
123 m_contrib.def(
"iou_3d_cpu", &
Iou3dCPU,
"boxes_a"_a,
"boxes_b"_a);
125 #ifdef BUILD_CUDA_MODULE
128 m_contrib.def(
"iou_bev_cuda", &IouBevCUDA,
"boxes_a"_a,
"boxes_b"_a);
129 m_contrib.def(
"iou_3d_cuda", &Iou3dCUDA,
"boxes_a"_a,
"boxes_b"_a);
#define AssertTensorDtype(tensor,...)
#define AssertTensorShape(tensor,...)
Tensor Contiguous() const
int64_t GetLength() const
Tensor To(Dtype dtype, bool copy=false) const
py::array TensorToPyArray(const Tensor &tensor)
Convert Tensor class to py::array (Numpy array).
Tensor PyArrayToTensor(py::array array, bool inplace)
py::array Iou3dCPU(py::array boxes_a, py::array boxes_b)
py::array IouBevCPU(py::array boxes_a, py::array boxes_b)
void IoUBevCPUKernel(const float *boxes_a, const float *boxes_b, float *iou, int num_a, int num_b)
void pybind_contrib_iou(py::module &m_contrib)
void IoU3dCPUKernel(const float *boxes_a, const float *boxes_b, float *iou, int num_a, int num_b)
constexpr nullopt_t nullopt
Generic file read and write utility for python interface.