InfiniOps
Operator Library for Accelerators
Loading...
Searching...
No Matches
normal.h
Go to the documentation of this file.
1#ifndef INFINI_OPS_BASE_NORMAL_H_
2#define INFINI_OPS_BASE_NORMAL_H_
3
4#include "operator.h"
5
6namespace infini::ops {
7
8class Normal : public Operator<Normal> {
9 public:
10 Normal(const Tensor mean, const double std, Tensor out)
11 : mean_shape_{mean.shape()},
12 mean_strides_{mean.strides()},
13 mean_type_{mean.dtype()},
14 out_shape_{out.shape()},
15 out_strides_{out.strides()},
16 out_type_{out.dtype()},
17 std_{std},
18 device_index_{out.device().index()} {}
19
20 Normal(const Tensor mean, const Tensor std, Tensor out)
21 : mean_shape_{mean.shape()},
22 mean_strides_{mean.strides()},
23 mean_type_{mean.dtype()},
24 out_shape_{out.shape()},
25 out_strides_{out.strides()},
26 out_type_{out.dtype()},
27 std_shape_{std.shape()},
28 std_strides_{std.strides()},
29 std_type_{std.dtype()},
30 device_index_{out.device().index()} {}
31
32 virtual void operator()(const Tensor mean, const double std,
33 Tensor out) const = 0;
34
35 virtual void operator()(const Tensor mean, const Tensor std,
36 Tensor out) const = 0;
37
38 protected:
39 Tensor::Shape mean_shape_;
40
41 Tensor::Strides mean_strides_;
42
43 DataType mean_type_;
44
45 Tensor::Shape out_shape_;
46
47 Tensor::Strides out_strides_;
48
49 DataType out_type_;
50
51 double std_{};
52
53 Tensor::Shape std_shape_;
54
55 Tensor::Strides std_strides_;
56
57 DataType std_type_;
58
60};
61
62} // namespace infini::ops
63
64#endif
Definition normal.h:8
Tensor::Strides out_strides_
Definition normal.h:47
DataType out_type_
Definition normal.h:49
Tensor::Strides std_strides_
Definition normal.h:55
Tensor::Shape std_shape_
Definition normal.h:53
virtual void operator()(const Tensor mean, const double std, Tensor out) const =0
Tensor::Shape out_shape_
Definition normal.h:45
Normal(const Tensor mean, const double std, Tensor out)
Definition normal.h:10
double std_
Definition normal.h:51
virtual void operator()(const Tensor mean, const Tensor std, Tensor out) const =0
int device_index_
Definition normal.h:59
DataType std_type_
Definition normal.h:57
Tensor::Shape mean_shape_
Definition normal.h:39
DataType mean_type_
Definition normal.h:43
Normal(const Tensor mean, const Tensor std, Tensor out)
Definition normal.h:20
Tensor::Strides mean_strides_
Definition normal.h:41
Definition generated/include/operator.h:282
Definition generated/include/operator.h:28
infini::rt::TensorView Tensor
Definition tensor.h:8