12 2022 档案

前置知识:一文简单上手pytorch
摘要:前言 Pytorch 由Facebook人工智能研究院于2017年推出,具有强大的GPU加速张量计算功能,并且能够自动进行微分计算,从而可以使用基于梯度的方法对模型参数进行优化。 Transformers库建立在Pytorch框架之上(Tensorflow的版本功能并不完善),我们需要通过 Pyto 阅读全文

posted @ 2022-12-17 23:12 朴素贝叶斯 阅读(352) 评论(0) 推荐(0) 编辑

第13章 C语言调试总结
摘要:在编写代码的过程中,相信大家肯定遇到过这样的情况:代码能够编译通过,没有语法错误,但是运行结果却不对,反复检查了很多遍,依然不知道哪里出了问题。这个时候,就需要调试程序了。 所谓调试(Debug),就是让代码一步一步慢慢执行,跟踪程序的运行过程。在调试的过程中,我们可以监控程序的每一个细节,包括变量 阅读全文

posted @ 2022-12-17 21:47 朴素贝叶斯 阅读(311) 评论(0) 推荐(0) 编辑

第9章 指针总结
摘要:指针也是C语言中最为困难的一部分,在学习中除了要正确理解基本概念,还必须要多编程,上机调试。 计算机中所有的数据都必须放在内存中,不同类型的数据占用的字节数不一样,例如 int 占用4个字节,char 占用1个字节。为了正确地访问这些数据,必须为每个字节都编上号码,就像门牌号、身份证号一样,每个字节 阅读全文

posted @ 2022-12-16 12:58 朴素贝叶斯 阅读(193) 评论(0) 推荐(0) 编辑

CLASS torch.nn.CrossEntropyLoss
摘要:# Example of target with class indices loss = nn.CrossEntropyLoss() input = torch.randn(3, 5, requires_grad=True) target = torch.empty(3, dtype=torch. 阅读全文

posted @ 2022-12-08 22:51 朴素贝叶斯 阅读(43) 评论(0) 推荐(0) 编辑

torch.Tensor.view(*shape)
摘要:x = torch.randn(4, 4) print("x size:",x.size()) y = x.view(16) print("y size:",y.size()) z = x.view(-1, 8) # the size -1 is inferred from other dimens 阅读全文

posted @ 2022-12-08 22:29 朴素贝叶斯 阅读(76) 评论(0) 推荐(0) 编辑

torch.tensor.to()
摘要:tensor = torch.randn(2, 2) # Initially dtype=float32, device=cpu tensor.to(torch.float64) cuda0 = torch.device('cuda:0') tensor.to(cuda0) tensor.to(cu 阅读全文

posted @ 2022-12-08 19:23 朴素贝叶斯 阅读(158) 评论(0) 推荐(0) 编辑

paddle批数据collate之Stack、Pad、Tuple、Dict
摘要:https://github.com/PaddlePaddle/PaddleNLP/blob/develop/paddlenlp/data/collate.py 阅读全文

posted @ 2022-12-06 00:07 朴素贝叶斯 阅读(120) 评论(0) 推荐(0) 编辑

DataCollatorWithPadding
摘要:@dataclass class DataCollatorWithPadding: """ Data collator that will dynamically pad the inputs to the longest sequence in the batch. Args: tokenizer 阅读全文

posted @ 2022-12-04 21:13 朴素贝叶斯 阅读(254) 评论(0) 推荐(0) 编辑

DataCollatorForTokenClassification
摘要:DataCollatorMixin类 class DataCollatorMixin: def __call__(self, features, return_tensors=None): if return_tensors is None: return_tensors = self.return 阅读全文

posted @ 2022-12-04 14:32 朴素贝叶斯 阅读(234) 评论(0) 推荐(0) 编辑

导航

< 2025年2月 >
26 27 28 29 30 31 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 1
2 3 4 5 6 7 8

统计

点击右上角即可分享
微信分享提示