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

at::Tensor ROIAlign_3d_forward_cuda(const at::Tensor& input,
                                    const at::Tensor& rois,
                                    const float spatial_scale,
                                    const int pooled_depth,
                                    const int pooled_height,
                                    const int pooled_width,
                                    const int sampling_ratio);

at::Tensor ROIAlign_3d_backward_cuda(const at::Tensor& grad,
                                     const at::Tensor& rois,
                                     const float spatial_scale,
                                     const int pooled_depth,
                                     const int pooled_height,
                                     const int pooled_width,
                                     const int batch_size,
                                     const int channels,
                                     const int depth,
                                     const int height,
                                     const int width,
                                     const int sampling_ratio);

at::Tensor nms_3d_cuda(const at::Tensor boxes, float nms_overlap_thresh);

at::Tensor overlap_3d_cuda(const at::Tensor boxes_1, const at::Tensor boxes_2);


void deform_conv3d_forward_cuda(at::Tensor input, at::Tensor weight, at::Tensor bias,
                                at::Tensor offset, at::Tensor output,
                                const int kernel_h, const int kernel_w, const int kernel_l,
                                const int stride_h, const int stride_w, const int stride_l,
                                const int pad_h, const int pad_w, const int pad_l,
                                const int dilation_h, const int dilation_w, const int dilation_l,
                                const int group, const int deformable_group, const int in_step, const bool with_bias);

void deform_conv3d_backward_cuda(at::Tensor input, at::Tensor weight, at::Tensor bias, at::Tensor offset,
                                 at::Tensor grad_input, at::Tensor grad_weight, at::Tensor grad_bias,
                                 at::Tensor grad_offset, at::Tensor grad_output,
                                 const int kernel_h, const int kernel_w, const int kernel_l,
                                 const int stride_h, const int stride_w, const int stride_l,
                                 const int pad_h, const int pad_w, const int pad_l,
                                 const int dilation_h, const int dilation_w, const int dilation_l,
                                 const int group, int deformable_group, const int in_step, const bool with_bias);

void modulated_deform_conv3d_forward_cuda(at::Tensor input, at::Tensor weight, at::Tensor bias,
        at::Tensor offset, at::Tensor mask, at::Tensor output,
        const int kernel_h, const int kernel_w, const int kernel_l,
        const int stride_h, const int stride_w, const int stride_l,
        const int pad_h, const int pad_w, const int pad_l,
        const int dilation_h, const int dilation_w, const int dilation_l,
        const int group, const int deformable_group, const int in_step, const bool with_bias);

void modulated_deform_conv3d_backward_cuda(at::Tensor input, at::Tensor weight, at::Tensor bias, at::Tensor offset, at::Tensor mask,
        at::Tensor grad_input, at::Tensor grad_weight, at::Tensor grad_bias,
        at::Tensor grad_offset, at::Tensor grad_mask, at::Tensor grad_output,
        const int kernel_h, const int kernel_w, const int kernel_l,
        const int stride_h, const int stride_w, const int stride_l,
        const int pad_h, const int pad_w, const int pad_l,
        const int dilation_h, const int dilation_w, const int dilation_l,
        const int group, const int deformable_group, const int in_step, const bool with_bias);
