File size: 841 Bytes
d5175d3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#include <torch/torch.h>
#include <vector>

std::vector<float*> dynamicconv_cpu_forward(
    float* input,
    float* filters,
    int padding_l);

std::vector<float*> dynamicconv_cpu_backward(
    float* gradOutput,
    int padding_l,
    float* input,
    float* filters);

std::vector<float*> dynamicconv_forward(
    float* input,
    float* filters,
    int padding_l) {

    return dynamicconv_cpu_forward(input, filters, padding_l);
}

std::vector<float*> dynamicconv_backward(
    float* gradOutput,
    int padding_l,
    float* input,
    float* filters) {

    return dynamicconv_cpu_backward(gradOutput, padding_l, input, filters);
}

PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) {
    m.def("forward", &dynamicconv_forward, "dynamicconv forward (CPU)");
    m.def("backward", &dynamicconv_backward, "dynamicconv backward (CPU)");
}