原书出处
Build a Reasoning Model (From Scratch)
natural logarithm, where 𝑙𝑜𝑔(0.0090) = -4.7109 and vice versa 𝑒-4.7109 = 0.0090. Instead of chaining torch.log(torch.softmax(...)), PyTorch also has an optimized torch.log_softmax function that combines these two operations: log_probas = torch.log_softmax(logits, dim=-1) print(log_probas) Similar to before, this returns: tensor([-4.7109, -4.0442, -3.3776, -2.7109, -2.0442, -1.3776, -0.7109]) Note that the log-scaling only changes the magnitude of the values, not the ordering, so a sequence with a higher
原书定位详情
来源:a19c7933-4eda-4176-aebd-30fe7e1ad292
正文位置:extracted/Build a Reasoning Model (From Scratch)/_epub-src/OEBPS/Text/chapter-5.html
EPUB SHA-256:52d4d07986020be70f5aac21762dfcf60fcba08db0ba29d4f63957caf12aa377