just to confirm is this a right way of creating mask:
let say I want to do dropout with p=0.1
import torch
input1 = torch.rand(5,2,2)
mask = torch.bernoulli(input1.data.new(input1.data.size()).fill_(1-p))
input_after_dropout = mask*input1