From 12b2bf3077ff90746fc32ce939224bade8794393 Mon Sep 17 00:00:00 2001 From: ice Date: Tue, 6 Jan 2026 21:57:12 +0800 Subject: [PATCH 01/36] Add Add and AddScalar function declarations --- include/axono/{compute/cpu/operators => ops/cpu}/add.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) rename include/axono/{compute/cpu/operators => ops/cpu}/add.h (85%) diff --git a/include/axono/compute/cpu/operators/add.h b/include/axono/ops/cpu/add.h similarity index 85% rename from include/axono/compute/cpu/operators/add.h rename to include/axono/ops/cpu/add.h index f0ac04f..776ee3d 100644 --- a/include/axono/compute/cpu/operators/add.h +++ b/include/axono/ops/cpu/add.h @@ -1,11 +1,12 @@ +#pragma once + #include "axono/core/macros.h" #include "axono/core/tensor.h" #include "axono/core/types.h" namespace axono { -namespace compute { +namespace ops { namespace cpu { -namespace operators { AXONO_EXPORT core::Status Add(const core::Context &ctx, const core::Tensor &a, const core::Tensor &b, core::Tensor &result); @@ -14,7 +15,6 @@ AXONO_EXPORT core::Status AddScalar(const core::Context &ctx, const core::Tensor &a, void *scalar, size_t scalar_size, core::Tensor &result); -} // namespace operators } // namespace cpu -} // namespace compute +} // namespace ops } // namespace axono From 910366b525578711e477c41f1d03e310d0cd1cda Mon Sep 17 00:00:00 2001 From: ice Date: Tue, 6 Jan 2026 21:57:43 +0800 Subject: [PATCH 02/36] Update and rename include/axono/compute/cpu/operators/matmul.h to include/axono/ops/cpu/matmul.h --- include/axono/{compute/cpu/operators => ops/cpu}/matmul.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) rename include/axono/{compute/cpu/operators => ops/cpu}/matmul.h (77%) diff --git a/include/axono/compute/cpu/operators/matmul.h b/include/axono/ops/cpu/matmul.h similarity index 77% rename from include/axono/compute/cpu/operators/matmul.h rename to include/axono/ops/cpu/matmul.h index 6ae29c7..3564e67 100644 --- a/include/axono/compute/cpu/operators/matmul.h +++ b/include/axono/ops/cpu/matmul.h @@ -6,14 +6,12 @@ #include "axono/core/tensor.h" namespace axono { -namespace compute { +namespace ops { namespace cpu { -namespace operators { core::Status MatMul(const core::Context &ctx, const core::Tensor &a, const core::Tensor &b, core::Tensor &result); -} // namespace operators } // namespace cpu -} // namespace compute +} // namespace ops } // namespace axono From 413e0c55489227e0d9918b8bb1f000fed57fa189 Mon Sep 17 00:00:00 2001 From: ice Date: Tue, 6 Jan 2026 21:58:38 +0800 Subject: [PATCH 03/36] Update and rename include/axono/compute/cpu/operators/randn.h to include/axono/ops/cpu/randn.h --- include/axono/{compute/cpu/operators => ops/cpu}/randn.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) rename include/axono/{compute/cpu/operators => ops/cpu}/randn.h (64%) diff --git a/include/axono/compute/cpu/operators/randn.h b/include/axono/ops/cpu/randn.h similarity index 64% rename from include/axono/compute/cpu/operators/randn.h rename to include/axono/ops/cpu/randn.h index ddd3f4c..35137b1 100644 --- a/include/axono/compute/cpu/operators/randn.h +++ b/include/axono/ops/cpu/randn.h @@ -1,10 +1,15 @@ #pragma once + #include "axono/core/tensor.h" #include "axono/core/types.h" -namespace axono::compute::cpu::operators { +namespace axono { +namespace ops { +namespace cpu { core::Status Randn(const core::Context& ctx, core::Tensor& out, float mean = 0.0f, float stddev = 1.0f); -} // namespace axono::compute::cpu::operators +} // namespace cpu +} // namespace ops +} // namespace axono From 64f1b706e8673231380facf9be23204b72d08ed2 Mon Sep 17 00:00:00 2001 From: ice Date: Tue, 6 Jan 2026 21:59:19 +0800 Subject: [PATCH 04/36] Update and rename include/axono/compute/cpu/ops/relu.h to include/axono/ops/cpu/relu.h --- include/axono/{compute/cpu/ops => ops/cpu}/relu.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) rename include/axono/{compute/cpu/ops => ops/cpu}/relu.h (92%) diff --git a/include/axono/compute/cpu/ops/relu.h b/include/axono/ops/cpu/relu.h similarity index 92% rename from include/axono/compute/cpu/ops/relu.h rename to include/axono/ops/cpu/relu.h index e67c23c..88a71e4 100644 --- a/include/axono/compute/cpu/ops/relu.h +++ b/include/axono/ops/cpu/relu.h @@ -1,11 +1,12 @@ +#pragma once + #include "axono/core/macros.h" #include "axono/core/tensor.h" #include "axono/core/types.h" namespace axono { -namespace compute { -namespace cpu { namespace ops { +namespace cpu { core::Status DispatchRelu(const core::Tensor &input, core::Tensor &output); core::Status DispatchReluInplace(core::Tensor &tensor); @@ -13,7 +14,6 @@ core::Status Relu(const core::Context &ctx, const core::Tensor &input, core::Tensor &output); core::Status ReluInplace(const core::Context &ctx, core::Tensor &tensor); -} // namespace ops } // namespace cpu -} // namespace compute +} // namespace ops } // namespace axono From a3e847f8f6a15e34c8c157e7e0b2af4052a590d9 Mon Sep 17 00:00:00 2001 From: ice Date: Tue, 6 Jan 2026 21:59:50 +0800 Subject: [PATCH 05/36] Refactor namespace structure in add.h --- include/axono/compute/cuda/operators/add.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/axono/compute/cuda/operators/add.h b/include/axono/compute/cuda/operators/add.h index 95c9d3b..6cb8fbe 100644 --- a/include/axono/compute/cuda/operators/add.h +++ b/include/axono/compute/cuda/operators/add.h @@ -1,11 +1,12 @@ +#pragma once + #include "axono/core/macros.h" #include "axono/core/tensor.h" #include "axono/core/types.h" namespace axono { -namespace compute { +namespace ops { namespace cuda { -namespace operators { AXONO_EXPORT core::Status Add(const core::Context &ctx, const core::Tensor &a, const core::Tensor &b, core::Tensor &result); @@ -14,7 +15,6 @@ AXONO_EXPORT core::Status AddScalar(const core::Context &ctx, const core::Tensor &a, void *scalar, size_t scalar_size, core::Tensor &result); -} // namespace operators } // namespace cuda -} // namespace compute +} // namespace ops } // namespace axono From 16b30fc35e626e5d68b3b9f6cc1e0e51cd85de2d Mon Sep 17 00:00:00 2001 From: ice Date: Tue, 6 Jan 2026 22:00:24 +0800 Subject: [PATCH 06/36] Update and rename include/axono/compute/cuda/operators/add.h to include/axono/ops/cuda/add.h --- include/axono/{compute/cuda/operators => ops/cuda}/add.h | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename include/axono/{compute/cuda/operators => ops/cuda}/add.h (100%) diff --git a/include/axono/compute/cuda/operators/add.h b/include/axono/ops/cuda/add.h similarity index 100% rename from include/axono/compute/cuda/operators/add.h rename to include/axono/ops/cuda/add.h From 77553061557beba00f7fa95b375dcd371b1b4680 Mon Sep 17 00:00:00 2001 From: ice Date: Tue, 6 Jan 2026 22:00:48 +0800 Subject: [PATCH 07/36] Update and rename include/axono/compute/cuda/operators/matmul.h to include/axono/ops/cuda/matmul.h --- .../{compute/cuda/operators => ops/cuda}/matmul.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) rename include/axono/{compute/cuda/operators => ops/cuda}/matmul.h (73%) diff --git a/include/axono/compute/cuda/operators/matmul.h b/include/axono/ops/cuda/matmul.h similarity index 73% rename from include/axono/compute/cuda/operators/matmul.h rename to include/axono/ops/cuda/matmul.h index 21bf9bc..b6bdeaa 100644 --- a/include/axono/compute/cuda/operators/matmul.h +++ b/include/axono/ops/cuda/matmul.h @@ -1,16 +1,17 @@ +#pragma once + +#include + #include "axono/core/macros.h" #include "axono/core/tensor.h" -#include "axono/core/types.h" namespace axono { -namespace compute { +namespace ops { namespace cuda { -namespace operators { core::Status MatMul(const core::Context &ctx, const core::Tensor &a, const core::Tensor &b, core::Tensor &result); -} } // namespace cuda -} // namespace compute +} // namespace ops } // namespace axono From b8b37f5e7f58ff3c758b050c0f76072b1ccafe38 Mon Sep 17 00:00:00 2001 From: ice Date: Tue, 6 Jan 2026 22:01:16 +0800 Subject: [PATCH 08/36] Move randn.h to axono/ops/cuda directory --- .../axono/{compute/cuda/operators => ops/cuda}/randn.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) rename include/axono/{compute/cuda/operators => ops/cuda}/randn.h (63%) diff --git a/include/axono/compute/cuda/operators/randn.h b/include/axono/ops/cuda/randn.h similarity index 63% rename from include/axono/compute/cuda/operators/randn.h rename to include/axono/ops/cuda/randn.h index 0f7a174..a264b63 100644 --- a/include/axono/compute/cuda/operators/randn.h +++ b/include/axono/ops/cuda/randn.h @@ -1,10 +1,15 @@ #pragma once + #include "axono/core/tensor.h" #include "axono/core/types.h" -namespace axono::compute::cuda::operators { +namespace axono { +namespace ops { +namespace cuda { core::Status Randn(const core::Context& ctx, core::Tensor& out, float mean = 0.0f, float stddev = 1.0f); -} // namespace axono::compute::cuda::operators +} // namespace cuda +} // namespace ops +} // namespace axono From 7dfd25401c987125291717c7c3c304bc4fc4089e Mon Sep 17 00:00:00 2001 From: ice Date: Tue, 6 Jan 2026 22:02:09 +0800 Subject: [PATCH 09/36] Update and rename include/axono/compute/cuda/ops/relu.h to include/axono/ops/cuda/relu.h --- include/axono/{compute/cuda/ops => ops/cuda}/relu.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) rename include/axono/{compute/cuda/ops => ops/cuda}/relu.h (92%) diff --git a/include/axono/compute/cuda/ops/relu.h b/include/axono/ops/cuda/relu.h similarity index 92% rename from include/axono/compute/cuda/ops/relu.h rename to include/axono/ops/cuda/relu.h index 73ee490..5ec88bd 100644 --- a/include/axono/compute/cuda/ops/relu.h +++ b/include/axono/ops/cuda/relu.h @@ -1,11 +1,12 @@ +#pragma once + #include "axono/core/macros.h" #include "axono/core/tensor.h" #include "axono/core/types.h" namespace axono { -namespace compute { -namespace cuda { namespace ops { +namespace cuda { core::Status DispatchRelu(const core::Tensor &input, core::Tensor &output); core::Status DispatchReluInplace(core::Tensor &tensor); @@ -13,7 +14,6 @@ core::Status Relu(const core::Context &ctx, const core::Tensor &input, core::Tensor &output); core::Status ReluInplace(const core::Context &ctx, core::Tensor &tensor); -} // namespace ops } // namespace cuda -} // namespace compute +} // namespace ops } // namespace axono From c13bb27a145fc48758360ba75c7f8d7c2f1fe57e Mon Sep 17 00:00:00 2001 From: ice Date: Tue, 6 Jan 2026 22:03:03 +0800 Subject: [PATCH 10/36] Update module.h --- include/axono/core/module.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/include/axono/core/module.h b/include/axono/core/module.h index 35706ad..c7e031f 100644 --- a/include/axono/core/module.h +++ b/include/axono/core/module.h @@ -1,6 +1,10 @@ +#pragma once + #include "tensor.h" -namespace axono::core { +namespace axono { +namespace core { + class Module { private: std::unordered_map weights_; // 存储权重张量 @@ -13,4 +17,6 @@ class Module { } auto& weights() { return weights_; } }; -} + +} // namespace core +} // namespace axono From 2c29dc5475289b34275dde731110cacbf5f634dc Mon Sep 17 00:00:00 2001 From: ice Date: Tue, 6 Jan 2026 22:04:06 +0800 Subject: [PATCH 11/36] Update ops.h --- include/axono/core/ops.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/axono/core/ops.h b/include/axono/core/ops.h index 6c4bc92..6634206 100644 --- a/include/axono/core/ops.h +++ b/include/axono/core/ops.h @@ -54,5 +54,6 @@ class OpRegistry { }; \ static RegisterOp_##name register_op_##name; \ pybind11::object op_impl_##name(const pybind11::args& args) + } // namespace core } // namespace axono From e60b3af63d6be06c2d250d51f09f730b8257241d Mon Sep 17 00:00:00 2001 From: ice Date: Tue, 6 Jan 2026 22:04:35 +0800 Subject: [PATCH 12/36] Update tensor.h --- include/axono/core/tensor.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/axono/core/tensor.h b/include/axono/core/tensor.h index 1af22f6..57e80ea 100644 --- a/include/axono/core/tensor.h +++ b/include/axono/core/tensor.h @@ -14,6 +14,7 @@ // 遵循 lib, type namespace axono { namespace core { + class Tensor { public: // 构造函数 @@ -103,5 +104,6 @@ class Tensor { // 初始化数据存储 void InitializeStorage(); }; + } // namespace core } // namespace axono From bc8d8f611d6a76176af68463c736a78943b8abf0 Mon Sep 17 00:00:00 2001 From: ice Date: Tue, 6 Jan 2026 22:05:42 +0800 Subject: [PATCH 13/36] Update tensor.cpp --- src/core/tensor.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/tensor.cpp b/src/core/tensor.cpp index a8d0994..016d23e 100644 --- a/src/core/tensor.cpp +++ b/src/core/tensor.cpp @@ -6,12 +6,12 @@ #include // std::runtime_error #ifdef COMPILED_WITH_CUDA -#include "axono/compute/cuda/operators/randn.h" +#include "axono/ops/cuda/randn.h" #include "axono/core/cuda/detail.h" #include "axono/core/cuda/tensor/kernel.h" #endif -#include "axono/compute/cpu/operators/randn.h" +#include "axono/ops/cpu/randn.h" #include "axono/core/cpu/tensor/kernel.h" #include "axono/core/types.h" @@ -55,12 +55,12 @@ Tensor Tensor::randn(const std::vector &shape, DataType dtype, if (out.is_cuda()) { #ifdef COMPILED_WITH_CUDA - status = compute::cuda::operators::Randn(ctx, out, mean, stddev); + status = ops::cuda::Randn(ctx, out, mean, stddev); #else status = core::Status::DEVICE_ERROR; #endif } else { - status = compute::cpu::operators::Randn(ctx, out, mean, stddev); + status = ops::cpu::Randn(ctx, out, mean, stddev); } if (status != core::Status::OK) { From 7e0986c0aab9232b7751beb2639413da468b83f9 Mon Sep 17 00:00:00 2001 From: ice Date: Tue, 6 Jan 2026 22:06:20 +0800 Subject: [PATCH 14/36] Delete src/compute/cpu/operators/README.md --- src/compute/cpu/operators/README.md | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 src/compute/cpu/operators/README.md diff --git a/src/compute/cpu/operators/README.md b/src/compute/cpu/operators/README.md deleted file mode 100644 index e135ccf..0000000 --- a/src/compute/cpu/operators/README.md +++ /dev/null @@ -1,6 +0,0 @@ -### 用途 USAGE - -> #### CPU ONLY -> 本文件夹用于 `Compute` 中 的 `Operators` 的实现类函数 -> -> FOR Functions Of `Compute.Operators` From 7c84404bcf6a37a74c42657fad9897126b807ea3 Mon Sep 17 00:00:00 2001 From: ice Date: Tue, 6 Jan 2026 22:06:41 +0800 Subject: [PATCH 15/36] Update and rename src/compute/cpu/operators/add.cpp to src/ops/cpu/add.cpp --- .../cpu/operators => ops/cpu}/add.cpp | 34 ++++--------------- 1 file changed, 7 insertions(+), 27 deletions(-) rename src/{compute/cpu/operators => ops/cpu}/add.cpp (83%) diff --git a/src/compute/cpu/operators/add.cpp b/src/ops/cpu/add.cpp similarity index 83% rename from src/compute/cpu/operators/add.cpp rename to src/ops/cpu/add.cpp index 6c78d5e..4ccbddf 100644 --- a/src/compute/cpu/operators/add.cpp +++ b/src/ops/cpu/add.cpp @@ -1,26 +1,23 @@ -// Axono/src/compute/cpu/operators/add.cpp -#include "axono/compute/cpu/operators/add.h" - #include #include "axono/core/macros.h" +#include "axono/core/types.h" +#include "axono/core/tensor.h" namespace axono { -namespace compute { +namespace ops { namespace cpu { -namespace operators { template AXONO_FORCE_INLINE void AddBroadcastKernel(const T *a, const T *b, T *out, size_t M, size_t K) { for (size_t m = 0; m < M; ++m) { for (size_t k = 0; k < K; ++k) { - out[m * K + k] = a[m * K + k] + b[k]; // b 琚箍鎾� + out[m * K + k] = a[m * K + k] + b[k]; } } } -// 閫愬厓绱犲姞娉曞唴鏍� template AXONO_FORCE_INLINE void AddKernel(const T *a, const T *b, T *result, size_t num_elements) { @@ -29,7 +26,6 @@ AXONO_FORCE_INLINE void AddKernel(const T *a, const T *b, T *result, } } -// 鏍囬噺鍔犳硶鍐呮牳 template AXONO_FORCE_INLINE void AddScalarKernel(const T *a, T scalar, T *result, size_t num_elements) { @@ -38,11 +34,9 @@ AXONO_FORCE_INLINE void AddScalarKernel(const T *a, T scalar, T *result, } } -// 绫诲瀷鍒嗘淳鐨勫姞娉� AXONO_FORCE_INLINE core::Status DispatchAdd(const core::Tensor &a, const core::Tensor &b, core::Tensor &result) { - // 1. dtype 蹇呴』涓€鑷� if (a.dtype() != b.dtype() || a.dtype() != result.dtype()) { return core::Status::UNSUPPORTED_TYPE; } @@ -50,7 +44,6 @@ AXONO_FORCE_INLINE core::Status DispatchAdd(const core::Tensor &a, auto a_shape = a.shape(); auto b_shape = b.shape(); - /* 鎯呭舰 1锛氬畬鍏ㄥ悓褰㈢姸 鈫� 閫愬厓绱� */ if (a.IsSameShape(b) && a.IsSameShape(result)) { const size_t num = a.num_elements(); switch (a.dtype()) { @@ -74,7 +67,6 @@ AXONO_FORCE_INLINE core::Status DispatchAdd(const core::Tensor &a, } } - /* 鎯呭舰 2锛歔M,K] + [K] 骞挎挱 */ if (a_shape.size() == 2 && b_shape.size() == 1 && result.shape() == a_shape && a_shape[1] == b_shape[0]) { const size_t M = a_shape[0]; @@ -104,24 +96,20 @@ AXONO_FORCE_INLINE core::Status DispatchAdd(const core::Tensor &a, return core::Status::SHAPE_MISMATCH; } -// 绫诲瀷鍒嗘淳鐨勬爣閲忓姞娉� AXONO_FORCE_INLINE core::Status DispatchAddScalar(const core::Tensor &a, void *scalar, size_t scalar_size, core::Tensor &result) { auto num_elements = a.num_elements(); - // 妫€鏌ュ舰鐘朵竴鑷存€� if (!a.IsSameShape(result)) { return core::Status::SHAPE_MISMATCH; } - // 妫€鏌ユ暟鎹被鍨嬩竴鑷存€� if (a.dtype() != result.dtype()) { return core::Status::UNSUPPORTED_TYPE; } - // 鏍规嵁鏁版嵁绫诲瀷閫夋嫨鍐呮牳 switch (a.dtype()) { case core::DataType::FLOAT32: { float scalar_value = 0.0f; @@ -159,48 +147,40 @@ AXONO_FORCE_INLINE core::Status DispatchAddScalar(const core::Tensor &a, core::Status Add(const core::Context &ctx, const core::Tensor &a, const core::Tensor &b, core::Tensor &result) { - (void)ctx; // 鏆傛椂鏈娇鐢� + (void)ctx; - // 妫€鏌ユ暟鎹被鍨嬩竴鑷存€� if (a.dtype() != b.dtype()) { return core::Status::UNSUPPORTED_TYPE; } - // 璁剧疆缁撴灉寮犻噺鐨勫舰鐘� core::Status status = result.Resize(a.shape()); if (status != core::Status::OK) { return status; } - // 璁剧疆缁撴灉鐨勬暟鎹被鍨� if (result.dtype() != a.dtype()) { return core::Status::UNSUPPORTED_TYPE; } - // 璋冪敤鍐呮牳鎵ц鍔犳硶 return DispatchAdd(a, b, result); } core::Status AddScalar(const core::Context &ctx, const core::Tensor &a, void *scalar, size_t scalar_size, core::Tensor &result) { - (void)ctx; // 鏆傛椂鏈娇鐢� + (void)ctx; - // 璁剧疆缁撴灉寮犻噺鐨勫舰鐘� core::Status status = result.Resize(a.shape()); if (status != core::Status::OK) { return status; } - // 璁剧疆缁撴灉鐨勬暟鎹被鍨� if (result.dtype() != a.dtype()) { return core::Status::UNSUPPORTED_TYPE; } - // 璋冪敤鍐呮牳鎵ц鏍囬噺鍔犳硶 return DispatchAddScalar(a, scalar, scalar_size, result); } -} // namespace operators } // namespace cpu -} // namespace compute +} // namespace ops } // namespace axono From b16c90e03cbd94b5e45d5647fb1ddabd4ee37897 Mon Sep 17 00:00:00 2001 From: ice Date: Tue, 6 Jan 2026 22:07:03 +0800 Subject: [PATCH 16/36] Update matmul.cpp --- src/compute/cpu/operators/matmul.cpp | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/compute/cpu/operators/matmul.cpp b/src/compute/cpu/operators/matmul.cpp index 40354f4..a0d0afc 100644 --- a/src/compute/cpu/operators/matmul.cpp +++ b/src/compute/cpu/operators/matmul.cpp @@ -1,5 +1,3 @@ -#include "axono/compute/cpu/operators/matmul.h" - #include #include #include @@ -16,7 +14,9 @@ #define AXONO_USE_X86_INTRINSICS 0 #endif -namespace axono::compute::cpu::operators { +namespace axono { +namespace ops { +namespace cpu { constexpr size_t BLOCK_SIZE_M = 512; constexpr size_t BLOCK_SIZE_N = 512; @@ -386,12 +386,6 @@ void MatMulOptimizedKernel(const T *a, const T *b, T *result, size_t m, } } -} // namespace axono::compute::cpu::operators -namespace axono { -namespace compute { -namespace cpu { -namespace operators { - core::Status MatMul(const core::Context &ctx, const core::Tensor &a, const core::Tensor &b, core::Tensor &result) { (void)ctx; // 暂时未使用 @@ -459,7 +453,6 @@ core::Status MatMul(const core::Context &ctx, const core::Tensor &a, return core::Status::OK; } -} // namespace operators } // namespace cpu -} // namespace compute +} // namespace ops } // namespace axono From c18adeb887912246ac8c31f71120b1d03697a6ad Mon Sep 17 00:00:00 2001 From: ice Date: Tue, 6 Jan 2026 22:07:28 +0800 Subject: [PATCH 17/36] Rename src/compute/cpu/operators/matmul.cpp to src/ops/cpu/matmul.cpp --- src/{compute/cpu/operators => ops/cpu}/matmul.cpp | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/{compute/cpu/operators => ops/cpu}/matmul.cpp (100%) diff --git a/src/compute/cpu/operators/matmul.cpp b/src/ops/cpu/matmul.cpp similarity index 100% rename from src/compute/cpu/operators/matmul.cpp rename to src/ops/cpu/matmul.cpp From 74dfa755383ae75cd1a32eca03e9d23b0cd84dcf Mon Sep 17 00:00:00 2001 From: ice Date: Tue, 6 Jan 2026 22:07:48 +0800 Subject: [PATCH 18/36] Update and rename src/compute/cpu/operators/randn.cpp to src/ops/cpu/randn.cpp --- src/{compute/cpu/operators => ops/cpu}/randn.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) rename src/{compute/cpu/operators => ops/cpu}/randn.cpp (85%) diff --git a/src/compute/cpu/operators/randn.cpp b/src/ops/cpu/randn.cpp similarity index 85% rename from src/compute/cpu/operators/randn.cpp rename to src/ops/cpu/randn.cpp index eac35b3..bfb835e 100644 --- a/src/compute/cpu/operators/randn.cpp +++ b/src/ops/cpu/randn.cpp @@ -1,15 +1,15 @@ -#include "axono/compute/cpu/operators/randn.h" - #include #include #include "axono/core/macros.h" #include "axono/core/tensor.h" -namespace axono::compute::cpu::operators { +namespace axono { +namespace ops { +namespace cpu { namespace { -// 线程局部随机数生成器,避免多线程竞争 +// 线程局部随机数生成器 thread_local std::mt19937 rng(std::random_device{}()); template @@ -43,4 +43,6 @@ core::Status Randn(const core::Context& ctx, core::Tensor& out, float mean, return core::Status::OK; } -} // namespace axono::compute::cpu::operators +} // namespace cpu +} // namespace ops +} // namespace axono From ab08524fbe66d16121fa8212c61102e0052ed468 Mon Sep 17 00:00:00 2001 From: ice Date: Tue, 6 Jan 2026 22:08:09 +0800 Subject: [PATCH 19/36] Refactor namespace structure in relu.cpp --- src/compute/cpu/ops/relu.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/compute/cpu/ops/relu.cpp b/src/compute/cpu/ops/relu.cpp index e0aefff..df98c8c 100644 --- a/src/compute/cpu/ops/relu.cpp +++ b/src/compute/cpu/ops/relu.cpp @@ -5,11 +5,9 @@ #include "axono/core/types.h" namespace axono { -namespace compute { -namespace cpu { namespace ops { +namespace cpu { -/* ===== 内核 ===== */ template void ReluKernel(const T *input, T *output, size_t n) { for (size_t i = 0; i < n; ++i) output[i] = std::max(T(0), input[i]); @@ -19,7 +17,6 @@ void ReluInplaceKernel(T *data, size_t n) { for (size_t i = 0; i < n; ++i) data[i] = std::max(T(0), data[i]); } -/* ===== 分派 ===== */ core::Status DispatchRelu(const core::Tensor &input, core::Tensor &output) { if (!input.IsSameShape(output)) return core::Status::SHAPE_MISMATCH; if (input.dtype() != output.dtype()) return core::Status::UNSUPPORTED_TYPE; @@ -59,7 +56,6 @@ core::Status DispatchReluInplace(core::Tensor &tensor) { return core::Status::OK; } -/* ===== 对外接口实现 ===== */ core::Status Relu(const core::Context &ctx, const core::Tensor &input, core::Tensor &output) { (void)ctx; @@ -74,7 +70,6 @@ core::Status ReluInplace(const core::Context &ctx, core::Tensor &tensor) { return DispatchReluInplace(tensor); } -} // namespace ops } // namespace cpu -} // namespace compute +} // namespace ops } // namespace axono From 08b52fe8ff135128f3c909a4ee86a7f23fc1164c Mon Sep 17 00:00:00 2001 From: ice Date: Tue, 6 Jan 2026 22:08:21 +0800 Subject: [PATCH 20/36] Delete src/compute/cpu/ops/README.md --- src/compute/cpu/ops/README.md | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 src/compute/cpu/ops/README.md diff --git a/src/compute/cpu/ops/README.md b/src/compute/cpu/ops/README.md deleted file mode 100644 index 590ad1b..0000000 --- a/src/compute/cpu/ops/README.md +++ /dev/null @@ -1,6 +0,0 @@ -### 用途 USAGE - -> #### CPU ONLY -> 本文件夹用于 `Compute` 中 的 `Ops` 的实现类函数 -> -> FOR Functions Of `Compute.Ops` From fd1dca538a30d3f2d660017bc1843595d1d576f7 Mon Sep 17 00:00:00 2001 From: ice Date: Tue, 6 Jan 2026 22:08:39 +0800 Subject: [PATCH 21/36] Rename src/compute/cpu/ops/relu.cpp to src/ops/cpu/relu.cpp --- src/{compute/cpu/ops => ops/cpu}/relu.cpp | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/{compute/cpu/ops => ops/cpu}/relu.cpp (100%) diff --git a/src/compute/cpu/ops/relu.cpp b/src/ops/cpu/relu.cpp similarity index 100% rename from src/compute/cpu/ops/relu.cpp rename to src/ops/cpu/relu.cpp From fea8e95788e72bf4d8a59d79314a7142c98e2656 Mon Sep 17 00:00:00 2001 From: ice Date: Tue, 6 Jan 2026 22:08:57 +0800 Subject: [PATCH 22/36] Delete src/compute/cuda/operators/README.md --- src/compute/cuda/operators/README.md | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 src/compute/cuda/operators/README.md diff --git a/src/compute/cuda/operators/README.md b/src/compute/cuda/operators/README.md deleted file mode 100644 index 54d9cfe..0000000 --- a/src/compute/cuda/operators/README.md +++ /dev/null @@ -1,6 +0,0 @@ -### 用途 USAGE - -> #### CUDA ONLY -> 本文件夹用于 `Compute` 中 的 `Operators` 的实现类函数 -> -> FOR Functions Of `Compute.Operators` From 43f2b50f9681bee865ac762a945e5828b914f107 Mon Sep 17 00:00:00 2001 From: ice Date: Tue, 6 Jan 2026 22:09:26 +0800 Subject: [PATCH 23/36] Update and rename src/compute/cuda/operators/add.cu to src/ops/cuda/add.cu --- src/{compute/cuda/operators => ops/cuda}/add.cu | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) rename src/{compute/cuda/operators => ops/cuda}/add.cu (98%) diff --git a/src/compute/cuda/operators/add.cu b/src/ops/cuda/add.cu similarity index 98% rename from src/compute/cuda/operators/add.cu rename to src/ops/cuda/add.cu index e9bfc07..1822c00 100644 --- a/src/compute/cuda/operators/add.cu +++ b/src/ops/cuda/add.cu @@ -1,14 +1,14 @@ -#include "axono/core/macros.h" -#include "axono/core/tensor.h" -#include "axono/core/types.h" #include #include #include +#include "axono/core/macros.h" +#include "axono/core/tensor.h" +#include "axono/core/types.h" + namespace axono { -namespace compute { +namespace ops { namespace cuda { -namespace operators { // CUDA 逐元素加法内核 template @@ -179,7 +179,6 @@ core::Status AddScalar(const core::Context &ctx, const core::Tensor &a, return DispatchAddScalar(a, scalar, scalar_size, result); } -} // namespace operators } // namespace cuda -} // namespace compute +} // namespace ops } // namespace axono From 8bcda7ad4e1477012737000085ce9767a7c53cfc Mon Sep 17 00:00:00 2001 From: ice Date: Tue, 6 Jan 2026 22:09:57 +0800 Subject: [PATCH 24/36] Update matmul.cu --- src/compute/cuda/operators/matmul.cu | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/compute/cuda/operators/matmul.cu b/src/compute/cuda/operators/matmul.cu index 6de78da..9ab082d 100644 --- a/src/compute/cuda/operators/matmul.cu +++ b/src/compute/cuda/operators/matmul.cu @@ -1,16 +1,15 @@ +#include +#include + #include "axono/core/macros.h" #include "axono/core/tensor.h" -#include #include "axono/core/types.h" -#include namespace axono { -namespace compute { +namespace ops { namespace cuda { -namespace operators { - -// CUDA 矩阵乘法内核 - 使用共享内存优化 +// CUDA 矩阵乘法内核 template __global__ void MatMulKernel(const T *a, const T *b, T *result, size_t m, size_t n, size_t k) { @@ -27,7 +26,7 @@ __global__ void MatMulKernel(const T *a, const T *b, T *result, } } -// 优化的矩阵乘法内核(使用共享内存) +// 优化的矩阵乘法内核 template __global__ void MatMulOptimizedKernel(const T *a, const T *b, T *result, size_t m, size_t n, size_t k) { @@ -149,7 +148,6 @@ core::Status MatMul(const core::Context &ctx, const core::Tensor &a, const core: return DispatchMatMul(a, b, result); } -} // namespace kernel } // namespace cuda -} // namespace compute +} // namespace ops } // namespace axono From 5c4bce84b268c713e04a97ef38ce4b51cae75bb3 Mon Sep 17 00:00:00 2001 From: ice Date: Tue, 6 Jan 2026 22:10:14 +0800 Subject: [PATCH 25/36] Rename src/compute/cuda/operators/matmul.cu to src/ops/cuda/matmul.cu --- src/{compute/cuda/operators => ops/cuda}/matmul.cu | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/{compute/cuda/operators => ops/cuda}/matmul.cu (100%) diff --git a/src/compute/cuda/operators/matmul.cu b/src/ops/cuda/matmul.cu similarity index 100% rename from src/compute/cuda/operators/matmul.cu rename to src/ops/cuda/matmul.cu From 443512cf77b3bec4e1c49515d76b3aae50f47a3c Mon Sep 17 00:00:00 2001 From: ice Date: Tue, 6 Jan 2026 22:10:43 +0800 Subject: [PATCH 26/36] Update and rename src/compute/cuda/operators/randn.cu to src/ops/cuda/randn.cu --- .../cuda/operators => ops/cuda}/randn.cu | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) rename src/{compute/cuda/operators => ops/cuda}/randn.cu (82%) diff --git a/src/compute/cuda/operators/randn.cu b/src/ops/cuda/randn.cu similarity index 82% rename from src/compute/cuda/operators/randn.cu rename to src/ops/cuda/randn.cu index 6aa5b95..77bf55a 100644 --- a/src/compute/cuda/operators/randn.cu +++ b/src/ops/cuda/randn.cu @@ -1,13 +1,12 @@ -#include "axono/compute/cuda/operators/randn.h" -#include "axono/core/cuda/tensor/kernel.h" -#include "axono/core/types.h" #include #include +#include "axono/core/types.h" +#include "axono/core/tensor.h" + namespace axono { -namespace compute { +namespace ops { namespace cuda { -namespace operators { template __global__ void RandnKernel(T* data, size_t num_elements, float mean, float stddev, unsigned int seed) { @@ -53,17 +52,16 @@ core::Status Randn(const core::Context& ctx, core::Tensor& out, float mean, floa return core::Status::UNSUPPORTED_TYPE; } #else - return core::Status::DEVICE_ERROR; // 修复:使用正确的枚举值 + return core::Status::DEVICE_ERROR; #endif } else { - return core::Status::DEVICE_ERROR; // 修复:使用正确的枚举值 + return core::Status::DEVICE_ERROR; } } template core::Status DispatchRandn(const core::Context&, core::Tensor&, float, float); template core::Status DispatchRandn(const core::Context&, core::Tensor&, float, float); -} // namespace operators -} // namespace cuda -} // namespace compute -} // namespace axono +} // namespace cuda +} // namespace ops +} // namespace axono From abc15357b50a827756f29e96fed0087503de1849 Mon Sep 17 00:00:00 2001 From: ice Date: Tue, 6 Jan 2026 22:11:12 +0800 Subject: [PATCH 27/36] Update and rename src/compute/cuda/ops/relu.cu to src/ops/cuda/relu.cu --- src/{compute/cuda/ops => ops/cuda}/relu.cu | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) rename src/{compute/cuda/ops => ops/cuda}/relu.cu (92%) diff --git a/src/compute/cuda/ops/relu.cu b/src/ops/cuda/relu.cu similarity index 92% rename from src/compute/cuda/ops/relu.cu rename to src/ops/cuda/relu.cu index 3baff36..20db192 100644 --- a/src/compute/cuda/ops/relu.cu +++ b/src/ops/cuda/relu.cu @@ -2,17 +2,14 @@ #include #include -#include "axono/compute/cuda/ops/relu.h" // ← 关键:CUDA 自己的头文件 #include "axono/core/macros.h" #include "axono/core/tensor.h" #include "axono/core/types.h" namespace axono { -namespace compute { -namespace cuda { namespace ops { +namespace cuda { -/* ================ 内核 ================ */ template __global__ void ReluKernel(const T* __restrict__ input, T* __restrict__ output, @@ -33,7 +30,6 @@ __global__ void ReluInplaceKernel(T* data, int num_elements) { } } -/* ================ 启动配置 ================ */ inline dim3 CalculateLaunchConfig(int num_elements) { const int block_size = 256; int grid_size = (num_elements + block_size - 1) / block_size; @@ -43,7 +39,6 @@ inline dim3 CalculateLaunchConfig(int num_elements) { return dim3(grid_size); } -/* ================ 内部分派 ================ */ core::Status DispatchRelu(const core::Tensor& input, core::Tensor& output) { size_t n = input.num_elements(); if (n > INT_MAX) return core::Status::INVALID_ARGUMENT; @@ -118,7 +113,6 @@ core::Status DispatchReluInplace(core::Tensor& tensor) { return (err == cudaSuccess) ? core::Status::OK : core::Status::DEVICE_ERROR; } -/* ================ 对外接口 ================ */ core::Status Relu(const core::Context& ctx, const core::Tensor& input, core::Tensor& output) { @@ -133,7 +127,6 @@ core::Status ReluInplace(const core::Context& ctx, return DispatchReluInplace(tensor); } -} // namespace ops } // namespace cuda -} // namespace compute +} // namespace ops } // namespace axono From 97b48b02d746fba1987daa3e34bb245b14d5ace7 Mon Sep 17 00:00:00 2001 From: ice Date: Tue, 6 Jan 2026 22:11:19 +0800 Subject: [PATCH 28/36] Delete src/compute/cuda/ops/README.md --- src/compute/cuda/ops/README.md | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 src/compute/cuda/ops/README.md diff --git a/src/compute/cuda/ops/README.md b/src/compute/cuda/ops/README.md deleted file mode 100644 index d02b8f1..0000000 --- a/src/compute/cuda/ops/README.md +++ /dev/null @@ -1,6 +0,0 @@ -### 用途 USAGE - -> #### CUDA ONLY -> 本文件夹用于 `Compute` 中 的 `Ops` 的实现类函数 -> -> FOR Functions Of `Compute.Ops` From 7606e7a7115ab795fd120fdd1d0708f9ce04c86c Mon Sep 17 00:00:00 2001 From: ice Date: Tue, 6 Jan 2026 22:12:41 +0800 Subject: [PATCH 29/36] Update and rename add.h to add.h --- .../{compute/operators => ops/cpu}/add.h | 28 +++++++++---------- 1 file changed, 13 insertions(+), 15 deletions(-) rename include/axono/pybind/{compute/operators => ops/cpu}/add.h (77%) diff --git a/include/axono/pybind/compute/operators/add.h b/include/axono/pybind/ops/cpu/add.h similarity index 77% rename from include/axono/pybind/compute/operators/add.h rename to include/axono/pybind/ops/cpu/add.h index 58f8045..3826536 100644 --- a/include/axono/pybind/compute/operators/add.h +++ b/include/axono/pybind/ops/cpu/add.h @@ -1,17 +1,16 @@ #include -namespace py = pybind11; - #include "axono/core/ops.h" #ifdef COMPILED_WITH_CUDA -#include "axono/compute/cuda/operators/add.h" +#include "axono/ops/cuda/add.h" #endif -#include "axono/compute/cpu/operators/add.h" +#include "axono/ops/cpu/add.h" + +namespace py = pybind11; namespace axono { -namespace compute { -namespace operators { +namespace ops { py::object op_impl_add(const py::args& args); py::object op_impl_add_scalar(const py::args& args); @@ -27,10 +26,10 @@ REGISTER_OP(add) { core::Status status; if (a.is_cuda()) { #ifdef COMPILED_WITH_CUDA - status = cuda::operators::Add(ctx, a, b, result); + status = cuda::Add(ctx, a, b, result); #endif } else { - status = cpu::operators::Add(ctx, a, b, result); + status = cpu::Add(ctx, a, b, result); } if (status != core::Status::OK) throw std::runtime_error("执行 add 时出现问题,错误代码:" + std::to_string(static_cast(status))); @@ -51,10 +50,10 @@ REGISTER_OP(add_scalar) { float value = scalar.cast(); if (a.is_cuda()){ #ifdef COMPILED_WITH_CUDA - status = cuda::operators::AddScalar(ctx, a, &value, sizeof(float), result); + status = cuda::AddScalar(ctx, a, &value, sizeof(float), result); #endif } else { - status = cpu::operators::AddScalar(ctx, a, &value, sizeof(float), result); + status = cpu::AddScalar(ctx, a, &value, sizeof(float), result); } } if (status != core::Status::OK) { @@ -63,10 +62,10 @@ REGISTER_OP(add_scalar) { int32_t value = scalar.cast(); if (a.is_cuda()) { #ifdef COMPILED_WITH_CUDA - status = cuda::operators::AddScalar(ctx, a, &value, sizeof(int32_t), result); + status = cuda::AddScalar(ctx, a, &value, sizeof(int32_t), result); #endif } else { - status = cpu::operators::AddScalar(ctx, a, &value, sizeof(int32_t), result); + status = cpu::AddScalar(ctx, a, &value, sizeof(int32_t), result); } if (status != core::Status::OK) @@ -78,6 +77,5 @@ REGISTER_OP(add_scalar) { return pybind11::cast(result); } -} -} -} +} // namespace ops +} // namespace axono From 55ce7760cbfbb8ff1eba969ed0dd16ef16902a2c Mon Sep 17 00:00:00 2001 From: ice Date: Tue, 6 Jan 2026 22:12:59 +0800 Subject: [PATCH 30/36] Update and rename matmul.h to matmul.h --- .../{compute/operators => ops/cpu}/matmul.h | 28 ++++++++----------- 1 file changed, 12 insertions(+), 16 deletions(-) rename include/axono/pybind/{compute/operators => ops/cpu}/matmul.h (61%) diff --git a/include/axono/pybind/compute/operators/matmul.h b/include/axono/pybind/ops/cpu/matmul.h similarity index 61% rename from include/axono/pybind/compute/operators/matmul.h rename to include/axono/pybind/ops/cpu/matmul.h index 9ce6942..f9648b3 100644 --- a/include/axono/pybind/compute/operators/matmul.h +++ b/include/axono/pybind/ops/cpu/matmul.h @@ -1,15 +1,14 @@ #include -namespace py = pybind11; - #ifdef COMPILED_WITH_CUDA -#include "axono/compute/cuda/operators/matmul.h" +#include "axono/ops/cuda/matmul.h" #endif -#include "axono/compute/cpu/operators/matmul.h" +#include "axono/ops/cpu/matmul.h" + +namespace py = pybind11; namespace axono { -namespace compute { -namespace operators { +namespace ops { py::object op_impl_matmul(const py::args& args); @@ -19,19 +18,17 @@ REGISTER_OP(matmul) { } auto& a = pybind11::cast(args[0]); auto& b = pybind11::cast(args[1]); + size_t m = a.shape()[0]; + size_t n = b.shape()[1]; core::Context ctx; - core::Tensor result; core::Status status; - + core::Tensor result = core::Tensor(a.dtype(), std::vector{m, n}, a.device());; if (a.is_cuda()) { #ifdef COMPILED_WITH_CUDA - size_t m = a.shape()[0]; - size_t n = b.shape()[1]; - auto result = core::Tensor(a.dtype(), std::vector{m, n}, a.device()); - status = cuda::operators::MatMul(ctx, a, b, result); + status = cuda::MatMul(ctx, a, b, result); #endif } else { - status = compute::cpu::operators::MatMul(ctx, a, b, result); + status = cpu::MatMul(ctx, a, b, result); } if (status != core::Status::OK) throw std::runtime_error("执行 Matmul 时出现问题,错误代码:" + std::to_string(static_cast(status))); @@ -39,6 +36,5 @@ REGISTER_OP(matmul) { return pybind11::cast(result); } -} -} -} +} // namespace ops +} // namespace axono From 832b1b6e3ab63d4c40e14d9a3d4e28be8bb3df46 Mon Sep 17 00:00:00 2001 From: ice Date: Tue, 6 Jan 2026 22:13:11 +0800 Subject: [PATCH 31/36] Update relu.h --- include/axono/pybind/compute/ops/relu.h | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/include/axono/pybind/compute/ops/relu.h b/include/axono/pybind/compute/ops/relu.h index 4ca5873..79fec7d 100644 --- a/include/axono/pybind/compute/ops/relu.h +++ b/include/axono/pybind/compute/ops/relu.h @@ -1,17 +1,16 @@ #include -namespace py = pybind11; - #include "axono/core/tensor.h" #include "axono/core/ops.h" #ifdef COMPILED_WITH_CUDA -#include "axono/compute/cuda/ops/relu.h" +#include "axono/ops/cuda/relu.h" #endif -#include "axono/compute/cpu/ops/relu.h" +#include "axono/ops/cpu/relu.h" + +namespace py = pybind11; namespace axono { -namespace compute { namespace ops { py::object op_impl_relu(const py::args& args); @@ -30,16 +29,17 @@ REGISTER_OP(relu) { if (input.is_cuda()) { #ifdef COMPILED_WITH_CUDA - status = cuda::ops::Relu(ctx, input, output); + status = cuda::Relu(ctx, input, output); #endif } else { - status = cpu::ops::Relu(ctx, input, output); + status = cpu::Relu(ctx, input, output); } if (status != core::Status::OK) throw std::runtime_error("执行 ReLU 时出现问题,错误代码:" + std::to_string(static_cast(status))); return pybind11::cast(output); } + REGISTER_OP(relu_) { core::Context ctx; core::Tensor result; @@ -52,16 +52,16 @@ REGISTER_OP(relu_) { if (tensor.is_cuda()) { #ifdef COMPILED_WITH_CUDA - status = cuda::ops::ReluInplace(ctx, tensor); + status = cuda::ReluInplace(ctx, tensor); #endif } else { - status = cpu::ops::ReluInplace(ctx, tensor); + status = cpu::ReluInplace(ctx, tensor); } if (status != core::Status::OK) throw std::runtime_error("执行 ReLU 时出现问题,错误代码:" + std::to_string(static_cast(status))); return pybind11::cast(tensor); } -} -} -} + +} // namespace ops +} // namespace axono From c944ac3dfbba5094e598f56fedcae81ba0276dbf Mon Sep 17 00:00:00 2001 From: ice Date: Tue, 6 Jan 2026 22:13:56 +0800 Subject: [PATCH 32/36] Rename relu.h to relu.h --- include/axono/pybind/{compute/ops => ops/cpu}/relu.h | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename include/axono/pybind/{compute/ops => ops/cpu}/relu.h (100%) diff --git a/include/axono/pybind/compute/ops/relu.h b/include/axono/pybind/ops/cpu/relu.h similarity index 100% rename from include/axono/pybind/compute/ops/relu.h rename to include/axono/pybind/ops/cpu/relu.h From 6005a89c34dab37f245e979342e0383b66c7538e Mon Sep 17 00:00:00 2001 From: ice Date: Tue, 6 Jan 2026 22:14:58 +0800 Subject: [PATCH 33/36] Rename include/axono/pybind/ops/cpu/add.h to include/axono/pybind/ops/add.h --- include/axono/pybind/ops/{cpu => }/add.h | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename include/axono/pybind/ops/{cpu => }/add.h (100%) diff --git a/include/axono/pybind/ops/cpu/add.h b/include/axono/pybind/ops/add.h similarity index 100% rename from include/axono/pybind/ops/cpu/add.h rename to include/axono/pybind/ops/add.h From 4e9766b058d49ac98f00b6eb87600e793a4995ae Mon Sep 17 00:00:00 2001 From: ice Date: Tue, 6 Jan 2026 22:15:06 +0800 Subject: [PATCH 34/36] Rename include/axono/pybind/ops/cpu/matmul.h to include/axono/pybind/ops/matmul.h --- include/axono/pybind/ops/{cpu => }/matmul.h | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename include/axono/pybind/ops/{cpu => }/matmul.h (100%) diff --git a/include/axono/pybind/ops/cpu/matmul.h b/include/axono/pybind/ops/matmul.h similarity index 100% rename from include/axono/pybind/ops/cpu/matmul.h rename to include/axono/pybind/ops/matmul.h From 91f6a93af1c771fd75b84294e9c774c15a70ed69 Mon Sep 17 00:00:00 2001 From: ice Date: Tue, 6 Jan 2026 22:15:14 +0800 Subject: [PATCH 35/36] Rename include/axono/pybind/ops/cpu/relu.h to include/axono/pybind/ops/relu.h --- include/axono/pybind/ops/{cpu => }/relu.h | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename include/axono/pybind/ops/{cpu => }/relu.h (100%) diff --git a/include/axono/pybind/ops/cpu/relu.h b/include/axono/pybind/ops/relu.h similarity index 100% rename from include/axono/pybind/ops/cpu/relu.h rename to include/axono/pybind/ops/relu.h From 4771ed4247c0072fd6efeef7a9f4fdb05689439f Mon Sep 17 00:00:00 2001 From: ice Date: Tue, 6 Jan 2026 22:25:17 +0800 Subject: [PATCH 36/36] Update pybind11_module.cpp --- python/src/pybind11_module.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/python/src/pybind11_module.cpp b/python/src/pybind11_module.cpp index 25d5aea..790d752 100644 --- a/python/src/pybind11_module.cpp +++ b/python/src/pybind11_module.cpp @@ -2,12 +2,14 @@ #include #include -#include "axono/pybind/compute/operators/add.h" -#include "axono/pybind/compute/operators/matmul.h" -#include "axono/pybind/compute/ops/relu.h" +#include "axono/core/ops.h" + +#include "axono/pybind/ops/add.h" +#include "axono/pybind/ops/relu.h" +#include "axono/pybind/ops/matmul.h" + #include "axono/pybind/core/tensor.h" #include "axono/pybind/core/module.h" -#include "axono/core/ops.h" namespace py = pybind11;