Squash function is a non-linear function that ensures the length of almost zero for short vectors and a length of slightly below 1 for long vectors.
It is defined as:
Here \(x\) is a vector, it is \(x \in R^m\), \(m\) is the dimension of vector \(x\).
How to implement squash function in tensorflow.
You can view this tutorial to learn how to implement it.
Implement Squashing Function in Capsule Network Using TensorFlow – TensorFlow Tutorial