想要深入了解《Pyramid Stereo Matching Network》這篇論文相嵌,還是需要去看代碼腿时。下面就debug,代碼饭宾,看方法執(zhí)行的一個(gè)過(guò)程批糟。
我選擇的是submissuib.py文件。在
pred_disp=test(imgL,imgR)
這一行設(shè)置斷點(diǎn)看铆。開(kāi)始debug徽鼎。執(zhí)行step into。
首先進(jìn)入到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()
方法會(huì)調(diào)用 train()
方法纬傲。開(kāi)始訓(xùn)練。進(jìn)入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
開(kāi)始會(huì)執(zhí)行 self.training=mode
這一行代碼肤频, 然后調(diào)用自身的 __setattr__
方法叹括,