From 804c4054ba3f39e4cc4b0c6b4afa87c6465dd027 Mon Sep 17 00:00:00 2001 From: Jiacheng Huang Date: Wed, 13 May 2026 13:45:17 +0800 Subject: [PATCH] feat: add `replication_pad3d` base Rebased onto feat/torch-operator-bases with only src/base/replication_pad3d.h. --- src/base/replication_pad3d.h | 45 ++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 src/base/replication_pad3d.h diff --git a/src/base/replication_pad3d.h b/src/base/replication_pad3d.h new file mode 100644 index 000000000..5f491ef92 --- /dev/null +++ b/src/base/replication_pad3d.h @@ -0,0 +1,45 @@ +#ifndef INFINI_OPS_BASE_REPLICATION_PAD3D_H_ +#define INFINI_OPS_BASE_REPLICATION_PAD3D_H_ + +#include "operator.h" + +namespace infini::ops { + +class ReplicationPad3d : public Operator { + public: + ReplicationPad3d(const Tensor input, const std::vector padding, + 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()}, + padding_{padding}, + device_index_{out.device().index()} {} + + virtual void operator()(const Tensor input, + const std::vector padding, + 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_; + + std::vector padding_{}; + + int device_index_{0}; +}; + +} // namespace infini::ops + +#endif