diff --git a/python/paddle/fluid/inferencer.py b/python/paddle/fluid/inferencer.py index 7b5eed86e002b335c05d826fd3edd24bb84088bd..3ea50bf196d00152e6579623c981ecbfb57b8e3b 100644 --- a/python/paddle/fluid/inferencer.py +++ b/python/paddle/fluid/inferencer.py @@ -17,10 +17,12 @@ __all__ = ['Inferencer', ] class Inferencer(object): def __init__(self, network_func, params, place=None): - # we need to generate a framework.Program by calling - # network_func reference: fluid.program_guard in test_word2vec.py - # move the default_main_program to self.program - # and run the default_startup program + # 1. we need to generate a framework.Program by calling + # network_func. Reference: fluid.program_guard in test_word2vec.py + + # 2. move the default_main_program to self.program. + + # 3. run the default_startup program. self.params = params self.place = place diff --git a/python/paddle/fluid/trainer.py b/python/paddle/fluid/trainer.py index bc49be6d50d05914048c6cbec54184c9552aa24b..aeda67650205a473486b05fdd5b4364753fb18ca 100644 --- a/python/paddle/fluid/trainer.py +++ b/python/paddle/fluid/trainer.py @@ -32,10 +32,16 @@ class Event(object): class Trainer(object): def __init__(self, network_func, optimizer, params=None, place=None): - # we need to generate a framework.Program by calling - # network_func reference: fluid.program_guard in test_word2vec.py - # move the default_main_program to self.program - # and run the default_startup program on an empty + # 1. we need to generate a framework.Program by calling + # network_func. Reference: fluid.program_guard in + # test_word2vec.py + + # 2. move the default_main_program to self.program and run the + # default_startup program on an empty core.Scope() + + # 3. call self.params.add_vars with the initialized scope, it + # will add the new vars of the initialized scope into + # self.params. self.network_func = network_func self.optimizer = optimizer self.params = params