class_docstr: ## Squash
  
  This is **squashing** function from paper, given by equation $(1)$.
  
  $$\mathbf{v}_j = rac{{\lVert \mathbf{s}_j 
  Vert}^2}{1 + {\lVert \mathbf{s}_j 
  Vert}^2}
   rac{\mathbf{s}_j}{\lVert \mathbf{s}_j 
  Vert}$$
  
  $rac{\mathbf{s}_j}{\lVert \mathbf{s}_j 
  Vert}$
  normalizes the length of all the capsules, whilst
  $rac{{\lVert \mathbf{s}_j 
  Vert}^2}{1 + {\lVert \mathbf{s}_j 
  Vert}^2}$
  shrinks the capsules that have a length smaller than one .
class_docstr_tok: ["#","#","Squash","This","is","*","*","squashing","*","*","function","from","paper",",","given","by","equation","$","(","1",")","$",".","$","$","\\mathbf","{","v","}","_j","=","rac","{","{","\\lVert","\\mathbf","{","s","}","_j","Vert","}","^2","}","{","1","+","{","\\lVert","\\mathbf","{","s","}","_j","Vert","}","^2","}","rac","{","\\mathbf","{","s","}","_j","}","{","\\lVert","\\mathbf","{","s","}","_j","Vert","}","$","$","$","rac","{","\\mathbf","{","s","}","_j","}","{","\\lVert","\\mathbf","{","s","}","_j","Vert","}","$","normalizes","the","length","of","all","the","capsules",",","whilst","$","rac","{","{","\\lVert","\\mathbf","{","s","}","_j","Vert","}","^2","}","{","1","+","{","\\lVert","\\mathbf","{","s","}","_j","Vert","}","^2","}","$","shrinks","the","capsules","that","have","a","length","smaller","than","one","."]
code: def __init__(self, epsilon=1e-8):
      super().__init__()
      self.epsilon = epsilon
  
file_path: annotated_deep_learning_paper_implementations/labml_nn/capsule_networks/__init__.py
imports: import torch.nn
  import torch.nn.functional
  import torch.utils.data
  from labml_helpers.module import Module
label_desc: Use image node_id 1 to create a new Squash object from inherited base classes: Module with example: obj = Squash(epsilon)