From 7fc367a5870a3d496c2eb098c13918cc9622044c Mon Sep 17 00:00:00 2001 From: Jiacheng Huang Date: Wed, 13 May 2026 14:38:51 +0800 Subject: [PATCH 1/2] feat: add `nextafter` base --- src/base/nextafter.h | 49 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 src/base/nextafter.h diff --git a/src/base/nextafter.h b/src/base/nextafter.h new file mode 100644 index 000000000..7147ae394 --- /dev/null +++ b/src/base/nextafter.h @@ -0,0 +1,49 @@ +#ifndef INFINI_OPS_BASE_NEXTAFTER_H_ +#define INFINI_OPS_BASE_NEXTAFTER_H_ + +#include "operator.h" + +namespace infini::ops { + +class Nextafter : public Operator { + public: + Nextafter(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()} {} + + virtual void operator()(const Tensor input, const Tensor 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_; + + int device_index_{0}; +}; + +} // namespace infini::ops + +#endif \ No newline at end of file From 2868ceb2b5e75c2d60c581b9981343208c53bb67 Mon Sep 17 00:00:00 2001 From: Jiacheng Huang Date: Mon, 18 May 2026 19:52:22 +0800 Subject: [PATCH 2/2] fix: add trailing newline to base header --- src/base/nextafter.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/base/nextafter.h b/src/base/nextafter.h index 7147ae394..2d5634c73 100644 --- a/src/base/nextafter.h +++ b/src/base/nextafter.h @@ -46,4 +46,4 @@ class Nextafter : public Operator { } // namespace infini::ops -#endif \ No newline at end of file +#endif