-
Notifications
You must be signed in to change notification settings - Fork 8
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
Structure Difference between PyTorch ResNet and JAX resnet (at layer 4) #5
Comments
Hi @sarahelsherif, thanks for raising this issue! Could you also paste in the PyTorch code that gives you |
Thank you @n2cholas , ok here is the PyTorch code:
the input_batch shape is : torch.Size([1, 3, 224, 224])
the output is : backbone resnet output shape torch.Size([1, 2048, 28, 28]) |
Hi @sarahelsherif, I wasn't able to directly use the code that you sent since I do not have Does that help? |
Hey @n2cholas , first of all thank you so much for help.
And thank you for your example, it helped. I know now why the output shape is different because of replacing strides and dilation in the pretrained resnet:
So, my issue is solved now about different output shapes. |
This can definitely be supported, essentially we would need to apply the logic in |
Yes, sure ..thank you so much for help. |
Hello Nicholas, while using pretrained RESNET(101)
I am comparing the output size of RESNET model in PyTorch after layer no. 4 (rendering the output before the avg pooling there)
after running it to an input batch size[1, 224, 224, 3]
It was torch.Size ([1, 2048, 28, 28]).
However, when I tried to render the output in your RESNET model JAX/FLAX (I have removed these 2 commented lines in RESNET function to get output before the avg pooling (layer4 equivalent to PyTorch)
It has a different output shape (for the same size of inp_batch(1, 224, 224, 3)) :
pretrained resnet100 size:--> (1, 7, 7, 2048)
So, what's happened at this stage in ResNet layers structure?
Kindly reply, if you have any explanation or recommendations.
The text was updated successfully, but these errors were encountered: