Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
groncarolo opened this issue Mar 14, 2023 · 1 comment
Open

Comments

@groncarolo
Copy link

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.

@ageron
Copy link
Owner

ageron commented Mar 16, 2023

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants