// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
#pragma once

#ifdef WITH_CUDA
#include "cuda/vision.h"
#endif


at::Tensor overlap_3d(const at::Tensor& boxes_1, const at::Tensor& boxes_2) {
    if (boxes_1.type().is_cuda() & boxes_2.type().is_cuda()) {
#ifdef WITH_CUDA
        // TODO raise error if not compiled with CUDA
        if ((boxes_1.numel() == 0) | (boxes_2.numel() == 0)) {
            return at::empty({0}, boxes_1.options().dtype(at::kLong).device(at::kCPU));
        }
        return overlap_3d_cuda(boxes_1, boxes_2);
#else
        AT_ERROR("Not compiled with GPU support");
#endif
    }
    AT_ERROR("Not implemented on the CPU");
}