Skip to content

Conversation

@chengtyao2-design
Copy link

Description

本 PR 完成了 NineToothed Operators (ntops) 作业要求的全部算子实现。
主要工作包括在 src/ntops/kernels 中实现算子逻辑,在 src/ntops/torch 中完成算子注册,并添加了相应的单元测试。

Implemented Kernels

实现了以下算子:

  • index_add: 实现了按索引进行加法操作。
  • nonzero_sum_gt_last2: 实现了计算非零元素和并判断是否大于最后两个元素和的逻辑。
  • one_hot: 实现了 One-Hot 编码转换。
  • topk: 实现了 Top-K 元素查找与排序。
  • where: 实现了基于条件的元素选择。

Changes

  • Kernels:

    • src/ntops/kernels/index_add.py
    • src/ntops/kernels/nonzero_sum_gt_last2.py
    • src/ntops/kernels/one_hot.py
    • src/ntops/kernels/topk.py
    • src/ntops/kernels/where.py
    • 更新 src/ntops/kernels/__init__.py 导出模块
  • Torch Registry:

    • src/ntops/torch/index_add.py
    • src/ntops/torch/nonzero_sum_gt_last2.py
    • src/ntops/torch/one_hot.py
    • src/ntops/torch/topk.py
    • src/ntops/torch/where.py
    • 更新 src/ntops/torch/__init__.py 注册算子
  • Tests:

    • tests/test_index_add.py
    • tests/test_nonzero_sum_gt_last2.py
    • tests/test_one_hot.py
    • tests/test_topk.py
    • tests/test_where.py

Testing

所有新增测试用例均已在本地通过。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant