MCPcopy Create free account
hub / github.com/Anoise/WTFlib / decode

Method decode

LDPS_Graph/layers/utils.py:272–286  ·  view source on GitHub ↗
(self, x, sample_idx=None)

Source from the content-addressed store, hash-verified

270 return x
271
272 def decode(self, x, sample_idx=None):
273 if sample_idx is None:
274 std = self.std + self.eps # n
275 mean = self.mean
276 else:
277 if len(self.mean.shape) == len(sample_idx[0].shape):
278 std = self.std[sample_idx] + self.eps # batch*n
279 mean = self.mean[sample_idx]
280 if len(self.mean.shape) > len(sample_idx[0].shape):
281 std = self.std[:,sample_idx]+ self.eps # T*batch*n
282 mean = self.mean[:,sample_idx]
283
284 # x is in shape of batch*n or T*batch*n
285 x = (x * std) + mean
286 return x
287
288 def cuda(self):
289 self.mean = self.mean.cuda()

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected