|
| 1 | +#ifndef INFINI_OPS_BASE_NOT_EQUAL_H_ |
| 2 | +#define INFINI_OPS_BASE_NOT_EQUAL_H_ |
| 3 | + |
| 4 | +#include "operator.h" |
| 5 | + |
| 6 | +namespace infini::ops { |
| 7 | + |
| 8 | +class NotEqual : public Operator<NotEqual> { |
| 9 | + public: |
| 10 | + NotEqual(const Tensor input, const double other, Tensor out) |
| 11 | + : input_shape_{input.shape()}, |
| 12 | + input_strides_{input.strides()}, |
| 13 | + input_type_{input.dtype()}, |
| 14 | + out_shape_{out.shape()}, |
| 15 | + out_strides_{out.strides()}, |
| 16 | + out_type_{out.dtype()}, |
| 17 | + other_{other}, |
| 18 | + device_index_{out.device().index()} {} |
| 19 | + |
| 20 | + NotEqual(const Tensor input, const Tensor other, Tensor out) |
| 21 | + : input_shape_{input.shape()}, |
| 22 | + input_strides_{input.strides()}, |
| 23 | + input_type_{input.dtype()}, |
| 24 | + out_shape_{out.shape()}, |
| 25 | + out_strides_{out.strides()}, |
| 26 | + out_type_{out.dtype()}, |
| 27 | + other_shape_{other.shape()}, |
| 28 | + other_strides_{other.strides()}, |
| 29 | + other_type_{other.dtype()}, |
| 30 | + device_index_{out.device().index()} {} |
| 31 | + |
| 32 | + virtual void operator()(const Tensor input, const double other, |
| 33 | + Tensor out) const = 0; |
| 34 | + |
| 35 | + virtual void operator()(const Tensor input, const Tensor other, |
| 36 | + Tensor out) const = 0; |
| 37 | + |
| 38 | + protected: |
| 39 | + Tensor::Shape input_shape_; |
| 40 | + |
| 41 | + Tensor::Strides input_strides_; |
| 42 | + |
| 43 | + DataType input_type_; |
| 44 | + |
| 45 | + Tensor::Shape out_shape_; |
| 46 | + |
| 47 | + Tensor::Strides out_strides_; |
| 48 | + |
| 49 | + DataType out_type_; |
| 50 | + |
| 51 | + double other_{}; |
| 52 | + |
| 53 | + Tensor::Shape other_shape_; |
| 54 | + |
| 55 | + Tensor::Strides other_strides_; |
| 56 | + |
| 57 | + DataType other_type_; |
| 58 | + |
| 59 | + int device_index_{0}; |
| 60 | +}; |
| 61 | + |
| 62 | +} // namespace infini::ops |
| 63 | + |
| 64 | +#endif |
0 commit comments