File size: 1,844 Bytes
708dec4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
#pragma once
#include "cpu/vision.h"

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


// Interface for Python
void deform_psroi_pooling_forward(

    at::Tensor input, 

    at::Tensor bbox, 

    at::Tensor trans, 

    at::Tensor out,

    at::Tensor top_count, 

    const int no_trans, 

    const float spatial_scale,

    const int output_dim, 

    const int group_size, 

    const int pooled_size,

    const int part_size, 

    const int sample_per_part, 

    const float trans_std)
{
  if (input.device().is_cuda()) {
#ifdef WITH_CUDA
    return deform_psroi_pooling_cuda_forward(
        input, bbox, trans, out, top_count, 
        no_trans, spatial_scale, output_dim, group_size,
        pooled_size, part_size, sample_per_part, trans_std
    );
#else
    AT_ERROR("Not compiled with GPU support");
#endif
  }
  AT_ERROR("Not implemented on the CPU");
}


void deform_psroi_pooling_backward(

    at::Tensor out_grad, 

    at::Tensor input, 

    at::Tensor bbox, 

    at::Tensor trans,

    at::Tensor top_count, 

    at::Tensor input_grad, 

    at::Tensor trans_grad,

    const int no_trans, 

    const float spatial_scale, 

    const int output_dim,

    const int group_size, 

    const int pooled_size, 

    const int part_size,

    const int sample_per_part, 

    const float trans_std) 
{
  if (input.device().is_cuda()) {
#ifdef WITH_CUDA
    return deform_psroi_pooling_cuda_backward(
        out_grad, input, bbox, trans, top_count, input_grad, trans_grad,
        no_trans, spatial_scale, output_dim, group_size, pooled_size, 
        part_size, sample_per_part, trans_std
    );
#else
    AT_ERROR("Not compiled with GPU support");
#endif
  }
  AT_ERROR("Not implemented on the CPU");
}