函数学习
Dawn_1999
这个作者很懒,什么都没留下…
展开
-
python中的getattr()方法——获取对象属性
在类中使用——getattr(self, attr):https://www.cnblogs.com/laoyulaoyu/p/7073606.html普通使用——getattr(object, attr):https://www.runoob.com/python/python-func-getattr.html转载 2022-04-01 16:51:49 · 247 阅读 · 0 评论 -
Python调用函数时传递带星号的参数问题
初学深度学习时使用斋藤康毅的鱼书,见到其中代码涉及到函数调用时使用“**”来传递参数,有些不理解,故做以下记录,将关键代码提取如下:以下为optimizer.py文件中对各优化算法的实现:class Momentum: def __init__(self, lr=0.01, momentum=0.9): ……class Adam: def __init__(self, lr=0.001, beta1=0.9, beta2=0.999): ……以下为traine原创 2021-11-04 16:43:17 · 653 阅读 · 0 评论 -
【随机数种子】torch.manual_seed()用法
torch.manual_seed()一般和torch.rand()、torch.rand原创 2021-05-31 10:56:52 · 7680 阅读 · 1 评论