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