Skip to content

[重构V] 修改命名空间、重定向 Operators、文件头引用、更好的统一格式化#40

Merged
Love-Asuka merged 36 commits intoByteRainTech:devfrom
aztice:keep-calm-and-carry-on
Jan 6, 2026
Merged

[重构V] 修改命名空间、重定向 Operators、文件头引用、更好的统一格式化#40
Love-Asuka merged 36 commits intoByteRainTech:devfrom
aztice:keep-calm-and-carry-on

Conversation

@aztice
Copy link
Member

@aztice aztice commented Jan 6, 2026

PR For

Cpp

PR Types

Code Enhancements

Description

命名空间

  • 对原有的 axono::compute::${device}::${type}::${opsName} 更新为 axono::ops::${opsName}::${device}
// 例子
// 令 算子注册 等流程不再需要
cuda::operators::Add(...);
// 只需要
cuda::Add(...);

重定向 Operators

  • 我们删除了 Operators 并将其重定向至 Ops,以更加方便管理,而不需要在开发新算子/其他开发时思考其细节分类。

文件引用

// 原有
#include "axono/core/macros.h"
#include <cuda_runtime.h>
#include "axono/core/types.h"
#include <cstddef>
// 改为
#include <cstddef>
#include <cuda_runtime.h>

#include "axono/core/types.h"
#include "axono/core/macros.h"
... 以此类推

更好的统一格式化

  • 所有 namespace 尾部均添加
namespace a {
namespace b {
// <-- 添加了空格
...
// <-- 添加了空格
} // namespace b <-- 添加额外注释标识
} // namespace a <-- 添加额外注释标识

aztice added 30 commits January 6, 2026 21:57
@aztice aztice requested a review from Love-Asuka January 6, 2026 14:23
@aztice aztice self-assigned this Jan 6, 2026
@paddle-bot
Copy link

paddle-bot bot commented Jan 6, 2026

Thanks for your contribution!

@codecov
Copy link

codecov bot commented Jan 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@aztice
Copy link
Member Author

aztice commented Jan 6, 2026

曾经
image
如今
image
CUDA 测试通过

是否执行单元测试-CUDA? (y/N): y
       db         8b        d8  ,ad8888ba,    888b      88    ,ad8888ba,
      d88b         Y8,    ,8P  d8"'    `"8b   8888b     88   d8"'    `"8b
     d8'`8b         `8b  d8'  d8'        `8b  88 `8b    88  d8'        `8b
    d8'  `8b          Y88P    88          88  88  `8b   88  88          88
   d8YaaaaY8b         d88b    88          88  88   `8b  88  88          88
  d8        8b      ,8P  Y8,  Y8,        ,8P  88    `8b 88  Y8,        ,8P
 d8'        `8b    d8'    `8b  Y8a.    .a8P   88     `8888   Y8a.    .a8P
d8'          `8b  8P        Y8  `"Y8888Y"'    88      `888    `"Y8888Y"'


为您运行 单元测试。
正发生
test_randn_basic_shape_dtype (test_randn.TestTensorRandn)
测试基本形状和数据类型生成 ... ok
test_randn_device_compatibility (test_randn.TestTensorRandn)
测试不同设备(CPU/CUDA)上的生成功能 ... ok
test_randn_distribution_properties (test_randn.TestTensorRandn)
测试正态分布的统计特性(均值和标准差) ... ok
test_randn_edge_cases (test_randn.TestTensorRandn)
测试边界情况(空张量、单元素) ... ok
test_randn_randomness (test_randn.TestTensorRandn)
测试每次调用生成不同的随机数 ... ok
test_tensor_creation (test_tensors.TestTensor)
测试 Tensor 创建 ... ok
test_tensor_data_types (test_tensors.TestTensor)
测试不同数据类型 ... ok
test_tensor_edge_cases (test_tensors.TestTensor)
测试边界情况 ... ok
test_tensor_fill (test_tensors.TestTensor)
测试 Tensor 填充 ... ok
test_tensor_fill_zero (test_tensors.TestTensor)
测试零填充 ... ok
test_tensor_large_array (test_tensors.TestTensor) ... ok
test_tensor_properties (test_tensors.TestTensor)
测试 Tensor 属性 ... ok
test_tensor_reshape (test_tensors.TestTensor)
测试 Tensor 重塑 ... ok
test_create_like (test_tensors.TestTensorFactoryMethods)
测试 create_like 方法 ... ok
test_zeros_ones_full (test_tensors.TestTensorFactoryMethods)
测试便捷创建函数 ... ok
test_weight (test_module.TestModule)
测试权重功能 ... ok
test_relu_basic (test_relu.TestRelu)
基础 ReLU:负值变 0,正值不变 ... ok
test_relu_basic_availability (test_relu.TestRelu)
使用 NumPy 实现 ReLU,并与 Axono 结果对比 ... ok
test_relu_inplace (test_relu.TestRelu)
原地 ReLU:数据被正确修改,对象可接受拷贝 ... ok
test_relu_large (test_relu.TestRelu)
大 tensor:确保所有输出 ≥ 0 ... ok
test_matmul_basic (test_matmul.TestMatmul)
测试基础矩阵乘法 ... ok
test_matmul_basic_availability (test_matmul.TestMatmul)
测试基础矩阵相乘是否有效 ... ok
test_matmul_different_sizes (test_matmul.TestMatmul)
测试不同大小的矩阵乘法:3x2 * 2x4 = 3x4 ... ok
test_matmul_large (test_matmul.TestMatmul)
测试大矩阵乘法 ... ok
test_add_basic (test_add.TestAdd)
测试基础逐元素加法 ... ok
test_add_basic_availability (test_add.TestAdd)
测试逐元素加法是否有效 ... ok
test_add_large (test_add.TestAdd)
测试大 tensor 逐元素加法 ... ok
test_add_validation (test_add.TestAdd)
测试不可广播形状应抛出异常 ... ok

----------------------------------------------------------------------
Ran 28 tests in 2.922s

OK

@Love-Asuka
Copy link
Contributor

good name space.

@Love-Asuka Love-Asuka merged commit 419ba18 into ByteRainTech:dev Jan 6, 2026
9 checks passed
@aztice aztice deleted the keep-calm-and-carry-on branch January 6, 2026 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants