From 57835dace94d33e5cf43bf164110120e8e42dca5 Mon Sep 17 00:00:00 2001 From: Jiacheng Huang Date: Wed, 13 May 2026 14:33:22 +0800 Subject: [PATCH 1/2] feat: add `bitwise_left_shift` base --- src/base/bitwise_left_shift.h | 64 +++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 src/base/bitwise_left_shift.h diff --git a/src/base/bitwise_left_shift.h b/src/base/bitwise_left_shift.h new file mode 100644 index 000000000..5ac764788 --- /dev/null +++ b/src/base/bitwise_left_shift.h @@ -0,0 +1,64 @@ +#ifndef INFINI_OPS_BASE_BITWISE_LEFT_SHIFT_H_ +#define INFINI_OPS_BASE_BITWISE_LEFT_SHIFT_H_ + +#include "operator.h" + +namespace infini::ops { + +class BitwiseLeftShift : public Operator { + public: + BitwiseLeftShift(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()} {} + + BitwiseLeftShift(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 4e3856b2ad4eb2dacb2b1d222d35828cf9d3e325 Mon Sep 17 00:00:00 2001 From: Jiacheng Huang Date: Mon, 18 May 2026 19:57:18 +0800 Subject: [PATCH 2/2] fix: add trailing newline to base header --- src/base/bitwise_left_shift.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/base/bitwise_left_shift.h b/src/base/bitwise_left_shift.h index 5ac764788..0b12a1fec 100644 --- a/src/base/bitwise_left_shift.h +++ b/src/base/bitwise_left_shift.h @@ -61,4 +61,4 @@ class BitwiseLeftShift : public Operator { } // namespace infini::ops -#endif \ No newline at end of file +#endif