(self, main_prog, startup_prog, is_train)
return out
build_program
build_program
build_program
def build_program(self, main_prog, startup_prog, is_train):
        """
            build_program
        """
        out = []
        with fluid.program_guard(main_prog, startup_prog):
            py_reader = self.build_input(self.im_shape, is_train)
            if is_train:
                with fluid.unique_name.guard():
                    loss, accuracy = self.fn_model(py_reader)
                    optimizer = fluid.optimizer.Momentum(
                        learning_rate=self.lr_strategy(),
                        momentum=0.9,
                        use_nesterov=True)
                    optimizer.minimize(loss)
                    out = [py_reader, loss, accuracy]
            else:
                with fluid.unique_name.guard():
                    loss, accuracy = self.fn_model(py_reader)
                    out = [py_reader, loss, accuracy]
        return out
def build_program ( self , main_prog , startup_prog , is_train ) : out = [ ] with fluid . program_guard ( main_prog , startup_prog ) : py_reader = self . build_input ( self . im_shape , is_train ) if is_train : with fluid . unique_name . guard ( ) : loss , accuracy = self . fn_model ( py_reader ) optimizer = fluid . optimizer . Momentum ( learning_rate = self . lr_strategy ( ) , momentum = 0.9 , use_nesterov = True ) optimizer . minimize ( loss ) out = [ py_reader , loss , accuracy ] else : with fluid . unique_name . guard ( ) : loss , accuracy = self . fn_model ( py_reader ) out = [ py_reader , loss , accuracy ] return out