From 52001de267a47be2b35c0798383d636dd655c5b3 Mon Sep 17 00:00:00 2001 From: Jiacheng Huang Date: Wed, 13 May 2026 14:38:39 +0800 Subject: [PATCH 1/2] feat: add `neg` base --- src/base/neg.h | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 src/base/neg.h diff --git a/src/base/neg.h b/src/base/neg.h new file mode 100644 index 000000000..7452977ee --- /dev/null +++ b/src/base/neg.h @@ -0,0 +1,39 @@ +#ifndef INFINI_OPS_BASE_NEG_H_ +#define INFINI_OPS_BASE_NEG_H_ + +#include "operator.h" + +namespace infini::ops { + +class Neg : public Operator { + public: + Neg(const Tensor input, 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()}, + device_index_{out.device().index()} {} + + virtual void operator()(const Tensor input, Tensor out) const = 0; + + protected: + Tensor::Shape input_shape_; + + Tensor::Strides input_strides_; + + DataType input_type_; + + Tensor::Shape out_shape_; + + Tensor::Strides out_strides_; + + DataType out_type_; + + int device_index_{0}; +}; + +} // namespace infini::ops + +#endif \ No newline at end of file From 2f4ee78c72b2c9dd201f9ed72c2874644154d9d3 Mon Sep 17 00:00:00 2001 From: Jiacheng Huang Date: Mon, 18 May 2026 19:52:36 +0800 Subject: [PATCH 2/2] fix: add trailing newline to base header --- src/base/neg.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/base/neg.h b/src/base/neg.h index 7452977ee..8e04ae23f 100644 --- a/src/base/neg.h +++ b/src/base/neg.h @@ -36,4 +36,4 @@ class Neg : public Operator { } // namespace infini::ops -#endif \ No newline at end of file +#endif