code: def drop_connect(inputs, p, training):
      """Drop connect.
  
      Args:
          input (tensor: BCWH): Input of this structure.
          p (float: 0.0~1.0): Probability of drop connection.
          training (bool): The running mode.
  
      Returns:
          output: Output after drop connection.
      """
      assert 0 <= p <= 1, "p must be in range of [0,1]"
  
      if not training:
          return inputs
  
      batch_size = inputs.shape[0]
      keep_prob = 1 - p
  
      # generate binary_tensor mask according to probability (p for 0, 1-p for 1)
      random_tensor = keep_prob
      random_tensor += torch.rand(
          [batch_size, 1, 1, 1],
          dtype=inputs.dtype,
          device=inputs.device,
      )
      binary_tensor = torch.floor(random_tensor)
  
      output = inputs / keep_prob * binary_tensor
      return output
  
imports: import re
  import math
  import collections
  from functools import partial
  import torch
  from torch import nn
  from torch.nn import functional
  from torch.utils import model_zoo
label_desc: Use image node_id 3 for calling a global function with example usage: drop_connect(inputs, p, training) and returns: output, inputs