9 guotong1988

尚未进行身份认证

Coding Forever

等级
TA的排名 248

mac pip3 openssl 报错 pip is configured with locations that require TLS/SSL

把pip源换成阿里的就好了,原来的要用ssl模块,换了就不用了新建~/.pip/pip.conf文件写入[global]index-url=http://mirrors.aliyun.com/pypi/simple/[install]trusted-host=mirrors.aliyun.com...

2019-11-11 09:42:15

python records 报错 Cannot operate on a closed database

importrecordsdb=records.Database('sqlite:///{}'.format("predict.db"))print()out=db.query('SELECTCOUNT(stock_name)fromSTOCKWHEREsp500_2018="true"andnasdaq_2018="true"')foritemin...

2019-11-04 10:51:41

pytorch 三维one-hot tensor的制作

importtorchbatch_size=2sequence_len=3hidden_dim=5x=torch.zeros(batch_size,sequence_len,hidden_dim).scatter_(dim=-1,index=torch.LongTensor([[[2],[2],[1]]...

2019-10-14 09:22:30

pytorch 报错 RuntimeError: Invalid index in scatter at

很大可能是因为index的值超出了范围,比如importtorchbatch_size=2hidden_dim=5x=torch.zeros(batch_size,hidden_dim).scatter_(dim=-1,index=torch.LongTensor([[2],[1]]),...

2019-10-14 09:19:38

pytorch one-hot tensor的制作

importtorchbatch_size=2hidden_dim=5x=torch.zeros(batch_size,hidden_dim).scatter_(dim=-1,index=torch.LongTensor([[2],[1]]),va...

2019-10-11 16:30:34

tf.einsum 的简化归纳理解

其实tf.einsum的参数归纳来说其实无非只是两种:1,常规的全连接层实现result=tf.einsum('mn,nh->mh',left_input,right_input)2,输出attentionmatrix的实现result=tf.einsum('mh,nh->mn',left_input,right_input)怎么折腾都是这两种,比如r...

2019-10-11 15:11:09

python sqlite insert 报错 no such column

直接写cur.execute("INSERTINTOtable_nameVALUES(value1,value2);")报的错nosuchcolumn这样写就好了:importsqlite3conn=sqlite3.connect('test.db')cur=conn.cursor()cur.execute("INSERTINTOtable_name...

2019-10-06 22:15:12

TrecQA 数据集下载

https://github.com/Kyung-Min/CompareModels_TRECQA/tree/master/datahttps://github.com/castorini/data/tree/master/TrecQA

2019-09-19 17:04:53

标准的BM25实现 for Lucene

importorg.apache.lucene.index.FieldInvertState;importorg.apache.lucene.index.IndexOptions;importorg.apache.lucene.search.CollectionStatistics;importorg.apache.lucene.search.Explanation;import...

2019-09-18 09:06:08

python 正则表达式 删除子字符串

importreline="Cats[123]aresmarterthandogs"result=re.sub(r'\[.*\]',"",line)print(result)line="Cats<123>aresmarterthandogs"result=re.sub(r'\<.*\>',"",line)pr...

2019-09-17 11:26:32

pandas dataframe 遍历

importpandasaspddf=pd.read_excel("renshe.xls",header=0)foriinrange(0,len(df)):print(df.iloc[i]['列名1'],df.iloc[i]['列名2'],df.iloc[i]['列名3'])print()

2019-09-17 10:02:03

NLP里怎样用attention为何用attention

attention在NLP里输入-输出就是可能这2种情况,两个输入和一个输出:输入一个sequence和一个item[batch_size,sequence_len,hidden_size][batch_size,hidden_size]输出[batch_size,hidden_size]或者输入一个sequence和一个sequence[batch_size,seque...

2019-09-16 09:39:04

一个self attention的pytorch实现

classSelfAttention(nn.Module):"""scoreseachelementofthesequencewithalinearlayerandusesthenormalizedscorestocomputeacontextoverthesequence."""def__init__(sel...

2019-09-12 16:13:03

百度simnet tensorflow代码

https://github.com/baidu/AnyQ/tree/master/tools/simnet

2019-09-11 16:55:22

tensorflow 学习率 decay 使用实例

learning_rate=tf.train.exponential_decay(initial_learning_rate,decay_steps=400,decay_rate=0.9,staircase=True)opt...

2019-09-11 11:10:46

tensorflow 3d cnn 代码

defCNN_3d(x,out_channels_0,out_channels_1,add_relu=True):'''Adda3dconvlutionlayerwithreluandmaxpoolinglayer.Args:x:atensorwithshape[batch,in_depth,in_height,i...

2019-09-11 10:28:52

tensorflow attend操作 代码

withtf.variable_scope('t_attend_r'):try:t_a_r=layers.block(t,r,r,...

2019-09-10 17:32:39

sqlova 代码走读

输入BERT的方式https://github.com/naver/sqlova/blob/master/sqlova/utils/utils_wikisql.py在generate_inputs方法[CLS]question_word_1,question_word_2,...question_word_n[SEP]header_1[SEP]header_2[SEP]......

2019-09-10 10:21:54

glyce 源码走读

核心在https://github.com/ShannonAI/glyce/blob/master/glyce/layers/glyce_transformer.pydefforward(self,input_ids,token_type_ids=None,attention_mask=None,):#一个embeddingglyph_embed,...

2019-09-10 09:31:44

pytorch attend操作 代码

#seq:[batch,sel_len,hidden_dim]#cond:[batch,hidden_dim]#lens:[batch]defattend(seq,cond,lens):"""attendoverthesequences`seq`usingthecondition`cond`."""scores=...

2019-09-09 08:34:42

查看更多

勋章 我的勋章
  • 专栏达人
    专栏达人
    授予成功创建个人博客专栏的用户。专栏中添加五篇以上博文即可点亮!撰写博客专栏浓缩技术精华,专栏达人就是你!
  • 持之以恒
    持之以恒
    授予每个自然月内发布4篇或4篇以上原创或翻译IT博文的用户。不积跬步无以至千里,不积小流无以成江海,程序人生的精彩需要坚持不懈地积累!
  • 1024超级勋章
    1024超级勋章
    授予原创文章总数达到1024篇的博主,感谢你对CSDN社区的贡献,CSDN与你一起成长。
  • 勤写标兵Lv3
    勤写标兵Lv3
    授予每个自然周发布7篇到8篇原创IT博文的用户。本勋章将于次周周三上午根据用户上周的博文发布情况由系统自动颁发。