(self)
build program
build program
build program
def build_program(self):
        """
            build program
        """
        self.predict_program = fluid.Program()
        self.train_program = fluid.Program()
        with fluid.program_guard(self.predict_program):
            self.predict_inputs = layers.data(
                    name='input',
                    append_batch_size=False,
                    shape=[self.batch_size, 1],
                    dtype='int32')
            self.predict_tokens, self.predict_adjvec = self.alg.define_predict(
                    self.predict_inputs)

        with fluid.program_guard(self.train_program):
            self.train_inputs = layers.data(
                    name='input',
                    append_batch_size=False,
                    shape=[self.batch_size, 1],
                    dtype='int32')
            self.actions_to = layers.data(
                    name='actions_to',
                    append_batch_size=False,
                    shape=[self.batch_size,
                           self.num_nodes * 2],
                    dtype='int32')
            self.actions_ad = layers.data(
                    name='actions_ad',
                    append_batch_size=False,
                    shape=[self.batch_size,
                           self.num_nodes * (self.num_nodes - 1)],
                    dtype='int32')
            self.rewards = layers.data(
                name='rewards',
                append_batch_size=False,
                shape=[self.batch_size],
                dtype='float32')
            self.cost = self.alg.define_learn(
                    obs=self.train_inputs, reward=self.rewards,
                    action=[self.actions_to, self.actions_ad])
def build_program ( self ) : self . predict_program = fluid . Program ( ) self . train_program = fluid . Program ( ) with fluid . program_guard ( self . predict_program ) : self . predict_inputs = layers . data ( name = 'input' , append_batch_size = False , shape = [ self . batch_size , 1 ] , dtype = 'int32' ) self . predict_tokens , self . predict_adjvec = self . alg . define_predict ( self . predict_inputs ) with fluid . program_guard ( self . train_program ) : self . train_inputs = layers . data ( name = 'input' , append_batch_size = False , shape = [ self . batch_size , 1 ] , dtype = 'int32' ) self . actions_to = layers . data ( name = 'actions_to' , append_batch_size = False , shape = [ self . batch_size , self . num_nodes * 2 ] , dtype = 'int32' ) self . actions_ad = layers . data ( name = 'actions_ad' , append_batch_size = False , shape = [ self . batch_size , self . num_nodes * ( self . num_nodes - 1 ) ] , dtype = 'int32' ) self . rewards = layers . data ( name = 'rewards' , append_batch_size = False , shape = [ self . batch_size ] , dtype = 'float32' ) self . cost = self . alg . define_learn ( obs = self . train_inputs , reward = self . rewards , action = [ self . actions_to , self . actions_ad ] )