Deep Networks with Stochastic De

2019-10-14  本文已影响0人  Cat丹

关键词:随机深度

实现细节

model = nn.Sequential(
    nn.Linear(10, 2)
)
...
loss.backward()
print(model[0].weight.grad)
self.m = torch.distributions.bernoulli.Bernoulli(torch.Tensor([self.prob]))
if torch.equal(self.m.sample(),torch.ones(1)):
    # 保留
上一篇 下一篇

猜你喜欢

热点阅读