InfiniOps
Operator Library for Accelerators
Loading...
Searching...
No Matches
relu_infinilm.h
Go to the documentation of this file.
1#ifndef INFINI_OPS_BASE_RELU_INFINILM_H_
2#define INFINI_OPS_BASE_RELU_INFINILM_H_
3
4#include <cassert>
5
6#include "operator.h"
7
8namespace infini::ops {
9
11class [[deprecated("Use `Relu` instead.")]] ReluInfinilm
12 : public Operator<ReluInfinilm> {
13 public:
14 ReluInfinilm(const Tensor input, Tensor out)
15 : input_shape_{input.shape()},
16 input_strides_{input.strides()},
17 input_type_{input.dtype()},
18 out_shape_{out.shape()},
19 out_strides_{out.strides()},
20 out_type_{out.dtype()},
21 output_size_{out.numel()},
22 ndim_{out.ndim()},
23 is_input_contiguous_{input.IsContiguous()},
24 is_out_contiguous_{out.IsContiguous()},
25 device_index_{out.device().index()} {
26 assert(input_shape_ == out_shape_ &&
27 "`ReluInfinilm` input and output shapes must match");
28 assert(input_type_ == out_type_ &&
29 "`ReluInfinilm` input and output dtypes must match");
30 assert(!out.HasBroadcastDim() &&
31 "`ReluInfinilm` output must not have broadcasted dimensions");
32 }
33
34 virtual void operator()(const Tensor input, Tensor out) const = 0;
35
36 protected:
37 Tensor::Shape input_shape_;
38
39 Tensor::Strides input_strides_;
40
41 DataType input_type_;
42
43 Tensor::Shape out_shape_;
44
45 Tensor::Strides out_strides_;
46
47 DataType out_type_;
48
49 Tensor::Size output_size_{0};
50
51 Tensor::Size ndim_{0};
52
53 bool is_input_contiguous_{false};
54
55 bool is_out_contiguous_{false};
56
57 int device_index_{0};
58};
59
60} // namespace infini::ops
61
62#endif
Definition generated/include/operator.h:282
Definition relu_infinilm.h:12
Tensor::Strides out_strides_
Definition relu_infinilm.h:45
Tensor::Strides input_strides_
Definition relu_infinilm.h:39
DataType out_type_
Definition relu_infinilm.h:47
Tensor::Shape out_shape_
Definition relu_infinilm.h:43
ReluInfinilm(const Tensor input, Tensor out)
Definition relu_infinilm.h:14
DataType input_type_
Definition relu_infinilm.h:41
virtual void operator()(const Tensor input, Tensor out) const =0
Tensor::Shape input_shape_
Definition relu_infinilm.h:37
Definition generated/include/operator.h:28
infini::rt::TensorView Tensor
Definition tensor.h:8