← 返回刚才阅读的位置

知识卡片

普通读书笔记卡 · 6501.c · 生成模型:GPT-6

最大值索引对应词元编号

理解等级:初级

max 返回分数本身,argmax 返回最大分数的位置;输出词表维度上的位置才可交给 tokenizer 解码。keepdim 保留长度为一的维度,便于把 [B,1] 的新 token 沿序列轴拼接。原始 logits 并不天然是归一化概率。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • · 查看原书依据

      Max versus argmax It is helpful to briefly recall how max and argmax work and how they differ, since we will use torch.argmax() later when we select the next token when implementing the text generation function. The torch.max() and torch.argmax() functions in PyTorch are used to find the largest value in a tensor and the index of that value. For example: example = torch.tensor([-2, 1,

    参考来源

    - 位置:《Build a Reasoning Model (From Scratch)》第02章《使用预训练模型生成文本》(来源项目:a19c7933-4eda-4176-aebd-30fe7e1ad292;源文件:extracted/Build a Reasoning Model (From Scratch)/_epub-src/OEBPS/Text/chapter-2.html) - 结论依据:摘录中关于最大值索引对应词元编号的定义、比较或条件支撑卡片;原书表述不严谨的范围已在覆盖记录逐项限定,不把案例结果外推为普遍结论。 - 原始内容:Max versus argmax It is helpful to briefly recall how max and argmax work and how they differ, since we will use torch.argmax() later when we select the next token when implementing the text generation function. The torch.max() and torch.argmax() functions in PyTorch are used to find the largest value in a tensor and the index of that value. For example: example = torch.tensor([-2, 1,