MCPcopy Create free account
hub / github.com/DragonisCV/RAM / save

Function save

scripts/analysis_utils.py:75–83  ·  view source on GitHub ↗

Save tensor as image.

(tensor, step)

Source from the content-addressed store, hash-verified

73 return attr_gabor
74
75def save(tensor, step):
76 """Save tensor as image."""
77 mean = [0.485, 0.456, 0.406]
78 std = [0.229, 0.224, 0.225]
79 mean_out = -1 * torch.tensor(mean) / torch.tensor(std)
80 std_out = 1 / torch.tensor(std)
81 output = normalize(tensor, mean_out, std_out, inplace=False)
82 output = tensor2img(output)
83 imwrite(output, f"result/cond/test/{step}.png")
84
85class Hook_back_loop:
86 """钩子类,用于捕获前向和后向信息"""

Callers

nothing calls this directly

Calls 2

tensor2imgFunction · 0.90
imwriteFunction · 0.90

Tested by

no test coverage detected