forked from zzd1992/Image-Local-Attention
-
Notifications
You must be signed in to change notification settings - Fork 0
/
localAttention.h
42 lines (34 loc) · 1.01 KB
/
localAttention.h
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
//
// Created by zhang on 20-1-14.
//
#ifndef LOCALATTENTION_LOCALATTENTION_H
#define LOCALATTENTION_LOCALATTENTION_H
#pragma once
#include <torch/extension.h>
torch::Tensor similar_cuda_forward(
const torch::Tensor &x_ori,
const torch::Tensor &x_loc,
const int kH,
const int kW);
torch::Tensor similar_cuda_backward(
const torch::Tensor &x,
const torch::Tensor &grad_out,
const int kH,
const int kW,
const bool is_ori);
torch::Tensor weighting_cuda_forward(
const torch::Tensor &x_ori,
const torch::Tensor &x_weight,
const int kH,
const int kW);
torch::Tensor weighting_cuda_backward_ori(
const torch::Tensor &x_weight,
const torch::Tensor &grad_out,
const int kH,
const int kW);
torch::Tensor weighting_cuda_backward_weight(
const torch::Tensor &x_ori,
const torch::Tensor &grad_out,
const int kH,
const int kW);
#endif //LOCALATTENTION_LOCALATTENTION_H