ageron/handson-ml2

CH12: Custom Models: number of iterations for lower Residual Block

groncarolo opened this issue · 1 comments

Hi,

First thank you for the truly amazing book!

I got a doubt on the number of iterations for the lower Residual Block Second Edition page 395

Figure 12-3 shows a x3 on the Lower residual block, so I thought it should iterate 3 times

But in the code, here and in the book I see

def call(self, inputs):
    [...]
    for _ in range(1 + 3):   # loops four times
        Z = self.block1(Z)

Am I simply reading the Figure wrong?

Thanks so much

G.

Thanks for your kind message, I really appreciate it!

Regarding your question, I understand how this can be confusing: the arrow's "x3" label is meant to indicate that the output will be fed back into the layer three times, so all in all, if we also count the very first pass, the layer ends up being called 4 times. I'm not sure how else to represent it. I tried to make this clear in the text:

The inputs go through a first dense layer, then through a residual block [...] then through this same residual block three more times, then through a second residual block, and the final result goes through a dense output layer.

Hope this helps!