上一页 1 ··· 4 5 6 7 8 9 10 下一页
摘要: global var_name global在函数中声明,表明在本地作用域中要使用全局作用域变量var_name。 但global解决不了嵌套函数中嵌套作用域的问题。 用nonlocal可以解决这个问题。nonlocal是python3新出的特性,python2中没有。 nonlocal可以实现这种 阅读全文
posted @ 2018-09-26 20:11 sbj123456789 阅读(314) 评论(0) 推荐(0) 编辑
摘要: RuntimeError:one of the variables needed for gradient computation has been modified by an inplace operation 原因:0.4.0把Varible和Tensor融合为一个Tensor,inplace 阅读全文
posted @ 2018-09-23 22:12 sbj123456789 阅读(4414) 评论(0) 推荐(0) 编辑
摘要: torch.distributions.Categorical() 功能:根据概率分布来产生sample,产生的sample是输入tensor的index 如: >>> m = Categorical(torch.tensor([ 0.25, 0.25, 0.25, 0.25 ])) >>> m.s 阅读全文
posted @ 2018-09-23 14:54 sbj123456789 阅读(6753) 评论(0) 推荐(1) 编辑
摘要: 接口 from nltk.corpus import wordnet as wn #用nltk的接口 wn.synsets('dog') #synsets的查询(一个synset由lemma.POS.number组成,代表一个语义);注意synset和synsets 的区别,synsets是list 阅读全文
posted @ 2018-09-19 11:56 sbj123456789 阅读(1447) 评论(0) 推荐(0) 编辑
摘要: log_softmax log(softmax(X)) function:torch.nn.functional.log_softmax(x, dim=None) nn:torch.nn.LogSoftmax(dim=None) (对于神经网络nn,上式是定义,在feed的时候读入的参数和nn.fu 阅读全文
posted @ 2018-08-24 23:29 sbj123456789 阅读(4433) 评论(0) 推荐(0) 编辑
摘要: one-hot encoding和常规label的转化 常规label指0,1,2,3,4,5,......(一个数代表一类) 增减layer: 参考 https://www.cnblogs.com/marsggbo/p/8781774.html 阅读全文
posted @ 2018-08-24 21:57 sbj123456789 阅读(1241) 评论(0) 推荐(0) 编辑
摘要: scipy.sparse.coo_matrix(arg1, shape=None, dtype=None, copy=False) 主要用于用坐标的方法来构造矩阵,并且由于在sparse下,用的是稀疏矩阵来存储,节省空间 主要用法是coo_matrix((data, (row, col)), sha 阅读全文
posted @ 2018-08-24 16:30 sbj123456789 阅读(387) 评论(0) 推荐(0) 编辑
摘要: batch/iteration/epoch的区别: 深度学习中的batch(batch size,full batch,mini batch, online learning)、iterations与epoch GCN相关: 深度学习新星 | 图卷积神经网络(GCN)有多强大? GRAPH CONV 阅读全文
posted @ 2018-08-24 14:52 sbj123456789 阅读(140) 评论(0) 推荐(0) 编辑
摘要: Python中的有序序列都支持切片(slice),例如list,string,array。 格式:【start:end:step】 start:起始索引,从0开始,-1表示结束 end:结束索引 step:步长,end-start,步长为正时,从左向右取值。步长为负时,反向取值 注意切片的结果不包含 阅读全文
posted @ 2018-08-21 14:45 sbj123456789 阅读(818) 评论(0) 推荐(0) 编辑
摘要: python自带的argparse包,常用于解析命令行的参数 使用方法example: import argparse parser = argparse.ArgumentParser() #将argparse包中的ArgumentParser类实例化 #向parser中添加argument,其具体 阅读全文
posted @ 2018-08-20 12:11 sbj123456789 阅读(768) 评论(0) 推荐(0) 编辑
上一页 1 ··· 4 5 6 7 8 9 10 下一页