7b34113cc3b5529a127bd02667de9de0b5b75df9,models/networks_basic.py,PNet,forward,#PNet#Any#Any#Any#,40
Before Change
if(retPerLayer):
all_scores = []
for (kk,out0) in enumerate(outs0):
cur_score = (1.-util.cos_sim(outs0[kk],outs1[kk]))
if(kk==0):
val = 1.*cur_score
else:
val = val + cur_score
if(retPerLayer):
all_scores+=[cur_score]
if(retPerLayer):
return (val, all_scores)
else:
return val
After Change
assert(in0.size()[0]==1) // currently only supports batchSize 1
if(self.colorspace=="RGB"):
value = util.dssim(1.*util.tensor2im(in0.data), 1.*util.tensor2im(in1.data), range=255.).astype("float")
elif(self.colorspace=="Lab"):
value = util.dssim(util.tensor2np(util.tensor2tensorlab(in0.data,to_norm=False)),
util.tensor2np(util.tensor2tensorlab(in1.data,to_norm=False)), range=100.).astype("float")
ret_var = Variable( torch.Tensor((value,) ) )
if(self.use_gpu):
ret_var = ret_var.cuda()
return ret_var
def print_network(net):
num_params = 0
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 8
Instances
Project Name: richzhang/PerceptualSimilarity
Commit Name: 7b34113cc3b5529a127bd02667de9de0b5b75df9
Time: 2019-07-26
Author: rich.zhang@eecs.berkeley.edu
File Name: models/networks_basic.py
Class Name: PNet
Method Name: forward
Project Name: dmlc/dgl
Commit Name: fde4f581d219e0d25148ffb0f8c44d6848032b53
Time: 2018-10-03
Author: wmjlyjemaine@gmail.com
File Name: examples/pytorch/gcn/gcn.py
Class Name:
Method Name: main
Project Name: dmlc/dgl
Commit Name: 8e71b64e2af321361217a621a89fb923ea0f984d
Time: 2018-10-03
Author: wmjlyjemaine@gmail.com
File Name: examples/pytorch/gat/gat.py
Class Name:
Method Name: main