3f196bcdd1e0310208e8978cf4f1fb590614568b,utils.py,,load_model,#,15
Before Change
return os.path.join(storage_dir(), "models", model_name+".pt")
def load_model(observation_space, action_space, from_path):
if from_path == None or not(os.path.exists(from_path)):
policy_net = Policy(observation_space, action_space)
value_net = Value(observation_space)
else:
policy_net, value_net = pickle.load(open(from_path, "rb"))
if ac_rl.use_gpu:
policy_net = policy_net.cuda()
value_net = value_net.cuda()
After Change
acmodel = ACModel(observation_space, action_space)
if from_path != None and os.path.exists(from_path):
acmodel.load_state_dict(torch.load(from_path))
return acmodel
def save_model(acmodel, to_path):
dirname = os.path.dirname(to_path)
if not(os.path.isdir(dirname)):
In pattern: SUPERPATTERN
Frequency: 4
Non-data size: 5
Instances
Project Name: lcswillems/torch-rl
Commit Name: 3f196bcdd1e0310208e8978cf4f1fb590614568b
Time: 2018-04-15
Author: lcswillems@gmail.com
File Name: utils.py
Class Name:
Method Name: load_model
Project Name: matthewwithanm/django-imagekit
Commit Name: f9c4d6b500888c059dcf4547a3442e6a7a582b27
Time: 2011-09-23
Author: matthew@exanimo.com
File Name: imagekit/models.py
Class Name: ImageSpecFile
Method Name: image
Project Name: matthewwithanm/django-imagekit
Commit Name: 71c56c7d6affae7506b298ad7f7c3855ce0e93a9
Time: 2012-02-12
Author: matthew@exanimo.com
File Name: imagekit/models/fields.py
Class Name: ImageSpecFieldFile
Method Name: generate
Project Name: matthewwithanm/django-imagekit
Commit Name: f9e02d250ed9a25d0a68f0937cbe4bd1bc175183
Time: 2009-01-14
Author: justin.driscoll@gmail.com
File Name: src/imagekit/specs.py
Class Name: Accessor
Method Name: _create