July 2019
Intermediate to advanced
512 pages
19h 39m
English
Now we will look at how the dynamic routing algorithm is implemented. We use variable names of the same notations that we learned in the dynamic routing algorithm, so that we can easily follow the steps. We will look at each line in our function step by step. You can also check the complete code on GitHub, at http://bit.ly/2HQqDEZ.
First, define the function called dynamic_routing, which takes the previous capsules, ui, coupling coefficients, bij, and number of routing iterations, num_routing as inputs as follows:
def dynamic_routing(ui, bij, num_routing=10):
Initialize the wij weights by drawing from a random normal distribution, and initialize biases with a constant value:
wij = tf.get_variable('Weight', ...Read now
Unlock full access