标签 Study 下的文章

Git创建本地分支并推送至远程仓库建立关联


老是忘,记一下吧创建 git 仓库:mkdir xxx cd xxx git init touch README.md git add README.md git commit -m "first commit" git remote add origin https://gitee.com/fmujie/xxxx.git git push -u origin "master"已有仓库,只需与远程建立连接cd existing_git_repo git remote add origin https://gitee.com/fmujie/xxx.git git push -u origin "master"以下参考自:Git本地创建分支并推送到远程 - 简书 (jianshu.com)1. 创建本地...

16、卷积残差模块算子融合


R-Drop: Regularized Dropout for Neural NetworksDropout is a powerful and widely used technique to regularize the training of deep neural networks. Dropout在训练和推理时存在不一致的问题(集成学习)R 对每个子模型的分布做一个KL散度import numpy as np def train_r_drop(ratio, x, w1, b1, w2, b2): # 输入复制一份 x = torch.cat([x, x], dim=0) layer1 = np.maximum(0, np.dot(w1, x) + b1) mask1 = np.random.binomial(1, 1...

15、Dropout原理以及Torch源码的实现


NN.DROPOUTCLASStorch.nn.Dropout(p=0.5, inplace=False)Parametersp (float) – probability of an element to be zeroed. Default: 0.5inplace (bool) – If set to True, will do this operation in-place. Default: FalseShape:Input: (∗)(∗). Input can be of any shapeOutput: (∗)(∗). Output is of the same shape as inputm = nn.Dropout(p=0.2) input = torch.randn(20, 16) output = m(input)如何判断当前是否为Trai...

9、PyTorch的nn.Sequential及ModuleList源码


train# 实例化一个模型,在模型后调用.train(True),说明我们将该模型设置为训练模式 def train(self: T, mode: bool = True) -> T: r"""Sets the module in training mode. This has any effect only on certain modules. See documentations of particular modules for details of their behaviors in training/evaluation mode, if they are affected, e.g. :class:`Dropout`, :class:`BatchNorm`, etc...

召唤看板娘