return tl.rein.choice_action_by_probs(_probs.ravel()) // sample according to probability distribution
def save(self): // save trained weights
if not os.path.exists(os.path.join("model", "ac")):
os.makedirs(os.path.join("model", "ac"))
tl.files.save_npz(self.model.trainable_weights, name=os.path.join("model", "ac", "model_actor.npz"))
def load(self): // load trained weights
tl.files.load_and_assign_npz(name=os.path.join("model", "ac", "model_actor.npz"), network=self.model)
After Change
return tl.rein.choice_action_by_probs(_probs.ravel()) // sample according to probability distribution
def save(self): // save trained weights
path = os.path.join("model", "_".join([ALG_NAME, ENV_ID]))
if not os.path.exists(path):
os.makedirs(path)
tl.files.save_npz(self.model.trainable_weights, name=os.path.join(path, "model_actor.npz"))
def load(self): // load trained weights
path = os.path.join("model", "_".join([ALG_NAME, ENV_ID]))