From e2993672197b59110f3c2d8c3522b7d17618d6f3 Mon Sep 17 00:00:00 2001 From: Jiacheng Huang Date: Wed, 13 May 2026 14:33:34 +0800 Subject: [PATCH 1/2] feat: add `bitwise_or` base --- src/base/bitwise_or.h | 64 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 src/base/bitwise_or.h diff --git a/src/base/bitwise_or.h b/src/base/bitwise_or.h new file mode 100644 index 000000000..82c973a69 --- /dev/null +++ b/src/base/bitwise_or.h @@ -0,0 +1,64 @@ +#ifndef INFINI_OPS_BASE_BITWISE_OR_H_ +#define INFINI_OPS_BASE_BITWISE_OR_H_ + +#include "operator.h" + +namespace infini::ops { + +class BitwiseOr : public Operator { + public: + BitwiseOr(const Tensor input, const Tensor other, Tensor out) + : input_shape_{input.shape()}, + input_strides_{input.strides()}, + input_type_{input.dtype()}, + other_shape_{other.shape()}, + other_strides_{other.strides()}, + other_type_{other.dtype()}, + out_shape_{out.shape()}, + out_strides_{out.strides()}, + out_type_{out.dtype()}, + device_index_{out.device().index()} {} + + BitwiseOr(const Tensor input, const double other, Tensor out) + : input_shape_{input.shape()}, + input_strides_{input.strides()}, + input_type_{input.dtype()}, + out_shape_{out.shape()}, + out_strides_{out.strides()}, + out_type_{out.dtype()}, + other_{other}, + device_index_{out.device().index()} {} + + virtual void operator()(const Tensor input, const Tensor other, + Tensor out) const = 0; + + virtual void operator()(const Tensor input, const double other, + Tensor out) const = 0; + + protected: + Tensor::Shape input_shape_; + + Tensor::Strides input_strides_; + + DataType input_type_; + + Tensor::Shape other_shape_; + + Tensor::Strides other_strides_; + + DataType other_type_; + + Tensor::Shape out_shape_; + + Tensor::Strides out_strides_; + + DataType out_type_; + + double other_{}; + + int device_index_{0}; +}; + +} // namespace infini::ops + +#endif \ No newline at end of file From be8eb38a222ae7c63c5c9979e5b19ed6c9452776 Mon Sep 17 00:00:00 2001 From: Jiacheng Huang Date: Mon, 18 May 2026 19:57:13 +0800 Subject: [PATCH 2/2] fix: add trailing newline to base header --- src/base/bitwise_or.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/base/bitwise_or.h b/src/base/bitwise_or.h index 82c973a69..133e6fe5d 100644 --- a/src/base/bitwise_or.h +++ b/src/base/bitwise_or.h @@ -61,4 +61,4 @@ class BitwiseOr : public Operator { } // namespace infini::ops -#endif \ No newline at end of file +#endif