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