想要深入了解《Pyramid Stereo Matching Network》这篇论文,还是需要去看代码。下面就debug,代码,看方法执行的一个过程。
我选择的是submissuib.py文件。在
pred_disp=test(imgL,imgR)
这一行设置断点。开始debug。执行step into。
首先进入到module.py文件的 eval()
方法中。
def eval(self):
Sets the module in evaluation mode.
This has any effect only on certain modules. See documentations of
particular modules for details of their behaviors in training/evaluation
mode, if they are affected, e.g. :class:`Dropout`, :class:`BatchNorm`,
etc.
return self.train(False)
接着eval()
方法会调用 train()
方法。开始训练。进入train()
方法:
def train(self, mode=True):
r"""Sets the module in training mode.
This has any effect only on certain modules. See documentations of
particular modules for details of their behaviors in training/evaluation
mode, if they are affected, e.g. :class:`Dropout`, :class:`BatchNorm`,
etc.
Returns:
Module: self
"""
self.training = mode
for module in self.children():
module.train(mode)
return self
开始会执行 self.training=mode
这一行代码, 然后调用自身的 __setattr__
方法,