-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathupsample_nearest3d_backward.h
More file actions
51 lines (36 loc) · 1.47 KB
/
upsample_nearest3d_backward.h
File metadata and controls
51 lines (36 loc) · 1.47 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
46
47
48
49
50
51
#ifndef INFINI_OPS_BASE_UPSAMPLE_NEAREST3D_BACKWARD_H_
#define INFINI_OPS_BASE_UPSAMPLE_NEAREST3D_BACKWARD_H_
#include "operator.h"
namespace infini::ops {
class UpsampleNearest3dBackward : public Operator<UpsampleNearest3dBackward> {
public:
UpsampleNearest3dBackward(const Tensor grad_output,
const std::vector<int64_t> output_size,
const std::vector<int64_t> input_size,
Tensor grad_input)
: grad_output_shape_{grad_output.shape()},
grad_output_strides_{grad_output.strides()},
grad_output_type_{grad_output.dtype()},
grad_input_shape_{grad_input.shape()},
grad_input_strides_{grad_input.strides()},
grad_input_type_{grad_input.dtype()},
output_size_{output_size},
input_size_{input_size},
device_index_{grad_input.device().index()} {}
virtual void operator()(const Tensor grad_output,
const std::vector<int64_t> output_size,
const std::vector<int64_t> input_size,
Tensor grad_input) const = 0;
protected:
Tensor::Shape grad_output_shape_;
Tensor::Strides grad_output_strides_;
DataType grad_output_type_;
Tensor::Shape grad_input_shape_;
Tensor::Strides grad_input_strides_;
DataType grad_input_type_;
std::vector<int64_t> output_size_{};
std::vector<int64_t> input_size_{};
int device_index_{0};
};
} // namespace infini::ops
#endif