Skip to content

[Feat] 算子注册#39

Merged
aztice merged 9 commits intoByteRainTech:devfrom
aztice:mmo
Jan 3, 2026
Merged

[Feat] 算子注册#39
aztice merged 9 commits intoByteRainTech:devfrom
aztice:mmo

Conversation

@aztice
Copy link
Member

@aztice aztice commented Jan 3, 2026

PR For

Cpp

PR Types

Feat

Description

// PyBind中算子部分不再通过手动 bind 实现绑定,而是算作是算子形式
axono::core::OpRegistry::instance().bind_all(m);

注册方法

// 1. 定义一个 py::object
py::object op_impl_$算子名(const py::args& args);
// 2. 开始注册
REGISTER_OP($算子名) {
  // 3. 可选(参数筛选)
  if (args.size() != 2) {
    throw std::runtime_error("执行 $参数名 需要传入 2 个 Tensor 喵~");
  }
  auto& a = pybind11::cast<core::Tensor&>(args[0]);
  auto& b = pybind11::cast<core::Tensor&>(args[1]);
  // 4. 你的实现(建议遵循 Axono 通用规范,也可自由发挥如是个人实验用途)
  // ...

  // 5. 返回转换
  return pybind11::cast($result);
}

@aztice aztice requested review from a team, changshuaicheng and cxykevin January 3, 2026 04:50
@aztice aztice self-assigned this Jan 3, 2026
@paddle-bot
Copy link

paddle-bot bot commented Jan 3, 2026

Thanks for your contribution!

@codecov
Copy link

codecov bot commented Jan 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@aztice aztice merged commit 5afa3c8 into ByteRainTech:dev Jan 3, 2026
9 checks passed
@aztice aztice deleted the mmo branch January 3, 2026 05:07
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.

1 participant