From 2bde841a164b08918baec5b04e377f4b58ac3e4d Mon Sep 17 00:00:00 2001 From: Jiacheng Huang Date: Wed, 13 May 2026 14:40:14 +0800 Subject: [PATCH 1/2] feat: add `renorm` base --- src/base/renorm.h | 50 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 src/base/renorm.h diff --git a/src/base/renorm.h b/src/base/renorm.h new file mode 100644 index 000000000..4ec3d33ff --- /dev/null +++ b/src/base/renorm.h @@ -0,0 +1,50 @@ +#ifndef INFINI_OPS_BASE_RENORM_H_ +#define INFINI_OPS_BASE_RENORM_H_ + +#include "operator.h" + +namespace infini::ops { + +class Renorm : public Operator { + public: + Renorm(const Tensor input, const double p, const int64_t dim, + const double maxnorm, 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()}, + p_{p}, + dim_{dim}, + maxnorm_{maxnorm}, + device_index_{out.device().index()} {} + + virtual void operator()(const Tensor input, const double p, const int64_t dim, + const double maxnorm, 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_; + + double p_{}; + + int64_t dim_{}; + + double maxnorm_{}; + + int device_index_{0}; +}; + +} // namespace infini::ops + +#endif \ No newline at end of file From badfca29f03470f54f0c370f3dddca3e0775251c Mon Sep 17 00:00:00 2001 From: Jiacheng Huang Date: Mon, 18 May 2026 19:51:19 +0800 Subject: [PATCH 2/2] fix: add trailing newline to base header --- src/base/renorm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/base/renorm.h b/src/base/renorm.h index 4ec3d33ff..455045edf 100644 --- a/src/base/renorm.h +++ b/src/base/renorm.h @@ -47,4 +47,4 @@ class Renorm : public Operator { } // namespace infini::ops -#endif \ No newline at end of file +#endif