MCPcopy Create free account
hub / github.com/MiniMax-AI/VTP / normalize_tensor

Function normalize_tensor

vtp/utils/lpips.py:169–171  ·  view source on GitHub ↗
(x, eps=1e-10)

Source from the content-addressed store, hash-verified

167
168
169def normalize_tensor(x, eps=1e-10):
170 norm_factor = torch.sqrt(torch.sum(x**2, dim=1, keepdim=True))
171 return x / (norm_factor + eps)
172
173
174def spatial_average(x, keepdim=True):

Callers 1

forwardMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected