0
点赞
收藏
分享

微信扫一扫

golang数据库操作相应内容--推荐【比较全】

小迁不秃头 2023-07-13 阅读 56

时间序列的表示

[seq_len, batch_size, vec ]  seq_len表示一个句子通常有多少个单词或者一个序列有多少个时间段,batch_size表示同时多个样本,vec表示单词的编码长度

 请问rnn和lstm中batchsize和timestep的区别是什么? - 知乎 (zhihu.com)

import torch
import torch.nn as nn
print(torch.__version__)

word_to_ix = {'hello':0, 'world':1}
lookup_tensor = torch.tensor([word_to_ix['hello']], dtype=torch.long)

embeds = nn.Embedding(2, 5)
hh=embeds(lookup_tensor)
print(hh)

 

RNN 

单层RNN

import torch.nn as nn
import torch

rnn = nn.RNN(input_size=100, hidden_size=20, num_layers=1)
print(rnn)
print(rnn._parameter
举报

相关推荐

0 条评论