forked from uber-research/GTN
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcustom_backward.cpp
More file actions
45 lines (38 loc) · 1.06 KB
/
custom_backward.cpp
File metadata and controls
45 lines (38 loc) · 1.06 KB
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
/*
Copyright (c) 2020 Uber Technologies, Inc.
Licensed under the Uber Non-Commercial License (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at the root directory of this project.
See the License for the specific language governing permissions and
limitations under the License.
*/
#include <torch/extension.h>
#include <vector>
#include <ATen/NativeFunctions.h>
#include <ATen/Config.h>
at::Tensor backward_weight(
c10::ArrayRef<long int> weight_size,
const at::Tensor &grad_output,
const at::Tensor &input,
c10::ArrayRef<long int> padding,
c10::ArrayRef<long int> stride,
c10::ArrayRef<long int> dilation,
int64_t groups,
bool benchmark,
bool deterministic)
{
return at::cudnn_convolution_backward_weight(
weight_size,
grad_output,
input,
padding,
stride,
dilation,
groups,
benchmark,
deterministic);
}
PYBIND11_MODULE(TORCH_EXTENSION_NAME, m)
{
m.def("backward", &backward_weight, "Conv2d backward cudnn");
}