original_docstring: 
      CapsNet's non-linear activation function for capsules.
      
docstring: CapsNet's non-linear activation function for capsules.
docstring_tokens: CapsNet ' s non - linear activation function for capsules .
code: def squash(caps, dim=-1, eps=1e-8):
      '''
      CapsNet's non-linear activation function for capsules.
      '''
      dot_prod = torch.sum(caps**2, axis=dim, keepdim=True) #dot product
      scalar_factor = dot_prod/(1+dot_prod)/torch.sqrt(dot_prod + eps)
      squashed = scalar_factor * caps
      return squashed
code_tokens: def squash ( caps , dim = - 1 , eps = 1e-8 ) : dot_prod = torch . sum ( caps ** 2 , axis = dim , keepdim = True ) scalar_factor = dot_prod / ( 1 + dot_prod ) / torch . sqrt ( dot_prod + eps ) squashed = scalar_factor * caps return squashed
short_docstring: CapsNet's non-linear activation function for capsules.
short_docstring_tokens: CapsNet ' s non - linear activation function for capsules .
comment: '''
      CapsNet's non-linear activation function for capsules.
      '''$SEP$#dot product