Calling clearState() on a lazy Dropout layer doesn't reset the flag, which means that the noise isn't generated again once it's called with a new input. This causes a crash as follows:
d = nn.Dropout(0.5,false,false,true)
input = torch.randn(2, 3)
d:forward(input)
d:clearState()
d:forward(input)
The simple fix is to reset flag to true when calling clearState().
Calling
clearState()
on a lazy Dropout layer doesn't reset theflag
, which means that the noise isn't generated again once it's called with a new input. This causes a crash as follows:The simple fix is to reset
flag
totrue
when callingclearState()
.