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

Method initialize

sat/sgm/modules/autoencoding/lpips/util.py:56–63  ·  view source on GitHub ↗
(self, input)

Source from the content-addressed store, hash-verified

54 self.register_buffer("initialized", torch.tensor(0, dtype=torch.uint8))
55
56 def initialize(self, input):
57 with torch.no_grad():
58 flatten = input.permute(1, 0, 2, 3).contiguous().view(input.shape[1], -1)
59 mean = flatten.mean(1).unsqueeze(1).unsqueeze(2).unsqueeze(3).permute(1, 0, 2, 3)
60 std = flatten.std(1).unsqueeze(1).unsqueeze(2).unsqueeze(3).permute(1, 0, 2, 3)
61
62 self.loc.data.copy_(-mean)
63 self.scale.data.copy_(1 / (std + 1e-6))
64
65 def forward(self, input, reverse=False):
66 if reverse:

Callers 3

forwardMethod · 0.95
reverseMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected