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

why tuple under function definition? #26

Closed
happynewya opened this issue Sep 30, 2018 · 1 comment
Closed

why tuple under function definition? #26

happynewya opened this issue Sep 30, 2018 · 1 comment

Comments

@happynewya
Copy link

In models.py, there are lots of tuple-under-function style code.
for example, _vgg_fc()

 55     def _vgg_fc(self):
 56         (self.feed('conv_out', 'rois')
 57              .roi_pool(7, 7, 1.0/16, name='pool5')
 58              .fc(4096, name='fc6')
 59              .dropout(self.keep_prob, name='drop6')
 60              .fc(4096, name='fc7')
 61              .dropout(self.keep_prob, name='vgg_out'))

I wonder what is the different from the code below?

 55     def _vgg_fc(self):
 56         self.feed('conv_out', 'rois')
 57              .roi_pool(7, 7, 1.0/16, name='pool5')
 58              .fc(4096, name='fc6')
 59              .dropout(self.keep_prob, name='drop6')
 60              .fc(4096, name='fc7')
 61              .dropout(self.keep_prob, name='vgg_out')
@danfeiX
Copy link
Owner

danfeiX commented Sep 30, 2018

This is how Python deals with chained function calls: https://stackoverflow.com/questions/4768941/how-to-break-a-line-of-chained-methods-in-python/4769685

@danfeiX danfeiX closed this as completed Oct 1, 2018
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