train_step = tf.train.AdamOptimizer(0.01).minimize(loss) sess = tf.InteractiveSession() init = tf.initialize_all_variables() sess.run(init) epoch=2000 for step in range(epoch): print(sess.run([train_step,loss], feed_dict={x: trainFeats, y:[t for t in trainlabels.as_matrix()]}))...
101 # loss_weights define the ratio of how much I care about optimizing each one 102 --> 103 model.load_weights("./weights/1pred_weights.25--0.08.hdf5", by_name=True) # the by_name=True allows you to use a different architecture and bring in the weights from the matching layers ...
loss = self.alg.learn(obs, act, reward) return loss.numpy()[0] def save(self): paddle.save(self.alg.model.state_dict(),'./savemodel/PG-Pong_net.pdparams') paddle.save(self.alg.optimizer.state_dict(), "./savemodel/opt.pdopt") def load(self): # 加载网络参数 model_state_dict=pa...