class_docstr: Implementation of locked (or variational) dropout.
  
  Randomly drops out entire parameters in embedding space.
class_docstr_tok: ["Implementation","of","locked","(","or","variational",")","dropout",".","Randomly","drops","out","entire","parameters","in","embedding","space","."]
code: def forward(self, x):
      if not self.training or not self.dropout_rate:
          return x
  
      if not self.batch_first:
          m = x.data.new(1, x.size(1), x.size(2)).bernoulli_(
              1 - self.dropout_rate
          )
      else:
          m = x.data.new(x.size(0), 1, x.size(2)).bernoulli_(
              1 - self.dropout_rate
          )
  
      mask = torch.autograd.Variable(m, requires_grad=False) / (
          1 - self.dropout_rate
      )
      mask = mask.expand_as(x)
      return mask * x
  
file_path: flair/flair/nn/dropout.py
imports: import torch
label_desc: Use image node_id 2 for calling the LockedDropout obj's underlying member method code with example usage: obj.forward(x) and returns: unknown, x