28914875e1a85a1c860ece7ddce715adbcd5c067,data/colorize_image.py,ColorizeImageTorch,prep_net,#ColorizeImageTorch#,215
Before Change
def prep_net(self, gpu_id=None, path="", dist=False):
import torch
import models.pytorch.model as model
device = torch.device("cuda:{}".format(gpu_id)) if gpu_id != -1 else torch.device("cpu")
print("path = %s, device = %s" % (path, device))
print("Model set! dist mode? ", dist)
self.net = model.SIGGRAPHGenerator(dist=dist)
state_dict = torch.load(path, map_location=str(device))
After Change
for key in list(state_dict.keys()): // need to copy keys here because we mutate in loop
self.__patch_instance_norm_state_dict(state_dict, self.net, key.split("."))
self.net.load_state_dict(state_dict)
if gpu_id != -1:
self.net.cuda()
self.net.eval()
self.net_set = True
def __patch_instance_norm_state_dict(self, state_dict, module, keys, i=0):
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 2
Instances Project Name: junyanz/interactive-deep-colorization
Commit Name: 28914875e1a85a1c860ece7ddce715adbcd5c067
Time: 2018-09-11
Author: junyanzhu89@gmail.com
File Name: data/colorize_image.py
Class Name: ColorizeImageTorch
Method Name: prep_net
Project Name: pytorch/tutorials
Commit Name: 2f5299a546fe23e2fff46630fc319387724b9aa5
Time: 2018-08-29
Author: minkawhich@fb.com
File Name: beginner_source/chatbot_tutorial.py
Class Name:
Method Name:
Project Name: galeone/dynamic-training-bench
Commit Name: 0a68639f4c33323274e7829b9349d0170dc6c8ea
Time: 2017-02-08
Author: nessuno@nerdz.eu
File Name: evaluate.py
Class Name:
Method Name: