InfiniOps
Operator Library for Accelerators
Loading...
Searching...
No Matches
internal_add_relu.h
Go to the documentation of this file.
1#ifndef INFINI_OPS_BASE_INTERNAL_ADD_RELU_H_
2#define INFINI_OPS_BASE_INTERNAL_ADD_RELU_H_
3
4#include "operator.h"
5
7
8class AddRelu : public Operator<AddRelu> {
9 public:
10 AddRelu(const Tensor input, const Tensor other, const double alpha,
11 Tensor out)
12 : input_shape_{input.shape()},
13 input_strides_{input.strides()},
14 input_type_{input.dtype()},
15 other_shape_{other.shape()},
16 other_strides_{other.strides()},
17 other_type_{other.dtype()},
18 out_shape_{out.shape()},
19 out_strides_{out.strides()},
20 out_type_{out.dtype()},
21 alpha_{alpha},
22 device_index_{out.device().index()} {}
23
24 virtual void operator()(const Tensor input, const Tensor other,
25 const double alpha, Tensor out) const = 0;
26
27 protected:
28 Tensor::Shape input_shape_;
29
30 Tensor::Strides input_strides_;
31
32 DataType input_type_;
33
34 Tensor::Shape other_shape_;
35
36 Tensor::Strides other_strides_;
37
38 DataType other_type_;
39
40 Tensor::Shape out_shape_;
41
42 Tensor::Strides out_strides_;
43
44 DataType out_type_;
45
46 double alpha_{};
47
49};
50
51} // namespace infini::ops::internal
52
53#endif
Definition generated/include/operator.h:282
Definition internal_add_relu.h:8
virtual void operator()(const Tensor input, const Tensor other, const double alpha, Tensor out) const =0
Tensor::Shape out_shape_
Definition internal_add_relu.h:40
AddRelu(const Tensor input, const Tensor other, const double alpha, Tensor out)
Definition internal_add_relu.h:10
DataType other_type_
Definition internal_add_relu.h:38
DataType out_type_
Definition internal_add_relu.h:44
double alpha_
Definition internal_add_relu.h:46
Tensor::Strides out_strides_
Definition internal_add_relu.h:42
int device_index_
Definition internal_add_relu.h:48
Tensor::Shape other_shape_
Definition internal_add_relu.h:34
Tensor::Strides other_strides_
Definition internal_add_relu.h:36
Tensor::Strides input_strides_
Definition internal_add_relu.h:30
DataType input_type_
Definition internal_add_relu.h:32
Tensor::Shape input_shape_
Definition internal_add_relu.h:28
Definition internal_add_relu.h:6
infini::rt::TensorView Tensor
Definition tensor.h:8