Skip to main content
. 2020 Mar 26;20(7):1841. doi: 10.3390/s20071841
Algorithm 1 Dynamic routing algorithm
  • 1:

    Procedure Routing (uj|i,r,l)

  • 2:

    for all capsule i in layer l and capsule j in layer (l+1):bij0.

  • 3:

    for r iterations do

  • 4:

        for all capsule i in layer l:ciSoftMax(bi)

  • 5:

        for all capsule j in layer (l+1):sjΣicijuij

  • 6:

        for all capsule j in layer (l+1):vjsquash(sj)

  • 7:

        for all capsule i in layer l and capsule j in layer (l+1):bijbij+uj|i·vj

  • 8:

    return vj