Update show.
This commit is contained in:
parent
59449df047
commit
2ad977a072
|
@ -78,11 +78,12 @@ def DumpTensorToImage(tensor, name, forceSquare=False, scale=1.0, Contrast=None,
|
||||||
|
|
||||||
|
|
||||||
def DumpTensorToLog(tensor, name="log"):
|
def DumpTensorToLog(tensor, name="log"):
|
||||||
shape = tensor.shape
|
|
||||||
tensor_mean = torch.mean(tensor).cpu().detach().numpy()
|
tensor_mean = torch.mean(tensor).cpu().detach().numpy()
|
||||||
|
tensor_abs_mean = torch.mean(torch.abs(tensor)).cpu().detach().numpy()
|
||||||
tensor_range = (torch.max(tensor) - torch.min(tensor)).cpu().detach().numpy()
|
tensor_range = (torch.max(tensor) - torch.min(tensor)).cpu().detach().numpy()
|
||||||
f = open(name, "w")
|
f = open(name, "w")
|
||||||
f.writelines("tensor mean: %s" % tensor_mean + os.linesep)
|
f.writelines("tensor mean: %s" % tensor_mean + os.linesep)
|
||||||
|
f.writelines("tensor abs mean: %s" % tensor_abs_mean + os.linesep)
|
||||||
f.writelines("tensor range: %s" % tensor_range + os.linesep)
|
f.writelines("tensor range: %s" % tensor_range + os.linesep)
|
||||||
data = tensor.reshape([-1]).float().cpu().detach().numpy().tolist()
|
data = tensor.reshape([-1]).float().cpu().detach().numpy().tolist()
|
||||||
for d in data:
|
for d in data:
|
||||||
|
|
Loading…
Reference in New Issue