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