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