NN框架
xcgfth
这个作者很懒,什么都没留下…
展开
-
PyTorch系列:torch.nn.LSTMCell
torch.nn.LSTMCell类是一个LSTM的一个cell。数学表达式为:i=σ(Wiix+bii+Whih+bhi)f=σ(Wifx+bif+Whfh+bhf)g=tanh(Wigx+big+Whgh+bhg)o=σ(Wiox+bio+Whoh+bho)c′=f∗c+i∗gh′=o∗tanh(c′)\begin{array}{ll} i = \sigma(W_{ii} x + b...原创 2019-12-17 09:56:09 · 947 阅读 · 0 评论 -
pytorch系列:torch.multinomial
torch.multinomial(input, num_samples, replacement=False, out=None)返回一个每一行包含num_samplesnum\_samplesnum_samples个从位于对应tensor的行通过多项式概率分布采样来值。注意:inputinputinput的行和不必是加和为1(在那些我们使用这些值作为权重的情况中),大必须是非负的,有限的和非...原创 2019-12-10 10:20:03 · 398 阅读 · 0 评论 -
pytroch系列:torch.where
torch.where(condition, input, other)返回inputinputinput或是otherotherother中满足condtioncondtioncondtion的元素。该操作定义为:outi={inputiif conditioniotheriotherwise \text{out}_i = \begin{cases} \text{input}...原创 2019-12-10 10:01:50 · 1262 阅读 · 0 评论 -
pytorch系列:torch.squeeze
torch.squeeze(input, dim=None, out=None) 返回一个输入的所有规模为1的维移除的tensor。如:输入的shape为:(A×1×B×C×1×D)(A \times 1 \times B \times C \times 1 \times D)(A×1×B×C×1×D),输出的tensor为:(A×B×C×D)(A \times B \times C \tim...原创 2019-12-10 09:44:29 · 207 阅读 · 0 评论 -
pytorch系列:torch.nn.init.xavier_uniform_
torch.nn.init.xavier_uniform_是一个服从均匀分布的Glorot初始化器,表达式为:U=(−a,a) \mathcal{U} = (-a, a)U=(−a,a)其中,a=gain×6fan_in+fan_out a = \text{gain} \times \sqrt{\frac{6}{\text{fan\_in} + \text{fan\_out}}}a=...原创 2019-12-10 09:23:49 · 13609 阅读 · 0 评论