From 2ad977a072b90fe3e9378717a9f4fd7af324eb00 Mon Sep 17 00:00:00 2001 From: Colin Date: Thu, 31 Oct 2024 00:01:57 +0800 Subject: [PATCH] Update show. --- tools/show.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/show.py b/tools/show.py index a9d2887..813d415 100644 --- a/tools/show.py +++ b/tools/show.py @@ -78,11 +78,12 @@ def DumpTensorToImage(tensor, name, forceSquare=False, scale=1.0, Contrast=None, def DumpTensorToLog(tensor, name="log"): - shape = tensor.shape 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() f = open(name, "w") 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) data = tensor.reshape([-1]).float().cpu().detach().numpy().tolist() for d in data: