InfiniOps
Operator Library for Accelerators
Loading...
Searching...
No Matches
internal_softmax.h
Go to the documentation of this file.
1#ifndef INFINI_OPS_BASE_INTERNAL_SOFTMAX_H_
2#define INFINI_OPS_BASE_INTERNAL_SOFTMAX_H_
3
4#include "operator.h"
5
6namespace infini::ops::internal {
7
8class Softmax : public Operator<Softmax> {
9 public:
10 Softmax(const Tensor input, const int64_t dim, const bool half_to_float,
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 dim_{dim},
19 half_to_float_{half_to_float},
20 device_index_{out.device().index()} {}
21
22 virtual void operator()(const Tensor input, const int64_t dim,
23 const bool half_to_float, 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 int64_t dim_{};
39
41
43};
44
45} // namespace infini::ops::internal
46
47#endif
Definition generated/include/operator.h:282
Definition internal_softmax.h:8
virtual void operator()(const Tensor input, const int64_t dim, const bool half_to_float, Tensor out) const =0
Softmax(const Tensor input, const int64_t dim, const bool half_to_float, Tensor out)
Definition internal_softmax.h:10
Tensor::Shape input_shape_
Definition internal_softmax.h:26
int device_index_
Definition internal_softmax.h:42
bool half_to_float_
Definition internal_softmax.h:40
DataType input_type_
Definition internal_softmax.h:30
DataType out_type_
Definition internal_softmax.h:36
Tensor::Shape out_shape_
Definition internal_softmax.h:32
int64_t dim_
Definition internal_softmax.h:38
Tensor::Strides input_strides_
Definition internal_softmax.h:28
Tensor::Strides out_strides_
Definition internal_softmax.h:34
Definition internal_add_relu.h:6
infini::rt::TensorView Tensor
Definition tensor.h:8