MCPcopy Create free account
hub / github.com/OpenDriveLab/ReSim / normalize_tensor

Function normalize_tensor

sat/sgm/modules/autoencoding/lpips/loss/lpips.py:126–128  ·  view source on GitHub ↗
(x, eps=1e-10)

Source from the content-addressed store, hash-verified

124
125
126def normalize_tensor(x, eps=1e-10):
127 norm_factor = torch.sqrt(torch.sum(x**2, dim=1, keepdim=True))
128 return x / (norm_factor + eps)
129
130
131def spatial_average(x, keepdim=True):

Callers 1

forwardMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected