Skip to content

issue/545 nn::module::Rope and nn::module::Swiglu#546

Merged
PanZezhong1725 merged 1 commit into
mainfrom
issue/545
Nov 10, 2025
Merged

issue/545 nn::module::Rope and nn::module::Swiglu#546
PanZezhong1725 merged 1 commit into
mainfrom
issue/545

Conversation

@Ceng23333
Copy link
Copy Markdown
Collaborator

No description provided.

Comment thread src/infinicore/nn/swiglu.cc Outdated
Comment thread include/infinicore/nn/rope.hpp Outdated

protected:
// Parameters (sin and cos cache tables)
INFINICORE_NN_PARAMETER(sin_cache);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cache 是 parameter?

Comment thread include/infinicore/nn/rope.hpp Outdated
std::string extra_repr() const;

// Accessors for parameters
Tensor sin_cache() const { return sin_cache_; }
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个东西没必要有个接口暴露出去吧。如果能多个rope共享同一个cache,那是有意义的。

Comment thread include/infinicore/nn/rope.hpp Outdated
RoPE(size_t head_dim,
size_t max_seq_len,
double theta = 10000.0,
infiniopRoPEAlgo_t algo = INFINIOP_ROPE_ALGO_GPT_J,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里不要用 INFINIOP 的enum。重新定义一个,后端实现的时候如果用infiniop再用这个enum

Comment thread include/infinicore/nn/swiglu.hpp Outdated

namespace infinicore::nn {

class SwiGLU : public Module {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SwiGLU既没有param也没有buffer,没必要做成module。要么作为op,要么nn::functional。和 @pengcheng888 对一下

@Ceng23333 Ceng23333 force-pushed the issue/545 branch 2 times, most recently from 66bf8f7 to 8d83173 Compare November 7, 2025 01:39
Comment thread include/infinicore/nn/functional.hpp Outdated
*
* For operations with parameters or state, use the corresponding Module classes.
*/
namespace functional {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

C++ 不要 nn::functional 字段了,感觉没什么意义,保留op里的接口就行

Signed-off-by: Ceng23333 <441651826@qq.com>
@PanZezhong1725 PanZezhong1725 merged commit cf6dff1 into main Nov 10, 2025
8 checks passed
@PanZezhong1725 PanZezhong1725 deleted the issue/545 branch November 10, 2025 01:30
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.

3 participants