def build_graph_mn(self): # EXTERNAL MEMORY # Embed the main input document u = self.main_docs if self.doc_emb_method == 'preload_update': u = self.doc_representation if self.doc_emb_method == 'preload_no_update': self.doc_representation = self.main_docs self.current_mem_size = self.mem_size if self.design == 'one': ''' One memory: only use user or product memory network, rather than both ''' m = MemoryModel(self.config, u, self.prd_docs, self.doc_emb) self.prediction_0 = m.pred_before_softmax self.prediction = m.pred self.params = [m.W] elif self.design == 'two': ''' separate two memory: one for user, one for product ''' m_usr = MemoryModel(self.config, u, self.usr_docs, self.doc_emb) m_prd = MemoryModel(self.config, u, self.prd_docs, self.doc_emb) self.params = [ m_usr.W, m_prd.W, m_usr.combineWeight, m_prd.combineWeight ] self.weight_usr = m_usr.combineWeight self.weight_prd = m_prd.combineWeight # Combine Two Network self.prediction_0 = tf.add(m_usr.pred_before_softmax, m_prd.pred_before_softmax) self.prediction = tf.nn.softmax(self.prediction_0)
def select_card(): mm = MemoryModel.get_instance() mouse_left_click(417, 228) mouse_move(489, 538) sleep(0.1) mouse_left_click(489, 538) sleep(0.1) mouse_left_click(570, 233) for p in [(360, 226), (259, 297), (40, 295), (149, 158), (92, 296), (206, 363), (356, 360), (160, 226)]: mouse_left_click(*p) mouse_move(227, 567) mouse_left_click(227, 567) # 等待游戏开始 orign = mm.read_int32_from_base(0x5568) while orign == mm.read_int32_from_base(0x5568): pass
def main(): open_game_window() mm = MemoryModel.get_instance() select_card() mm.strategy = GigaStrategy() mm.loop_start()