MCPcopy Create free account
hub / github.com/BorealisAI/scaleformer / decode

Method decode

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

Source from the content-addressed store, hash-verified

295 return x
296
297 def decode(self, x, sample_idx=None):
298 if sample_idx is None:
299 std = self.std + self.eps # n
300 mean = self.mean
301 else:
302 if len(self.mean.shape) == len(sample_idx[0].shape):
303 std = self.std[sample_idx] + self.eps # batch*n
304 mean = self.mean[sample_idx]
305 if len(self.mean.shape) > len(sample_idx[0].shape):
306 std = self.std[:,sample_idx]+ self.eps # T*batch*n
307 mean = self.mean[:,sample_idx]
308
309 # x is in shape of batch*n or T*batch*n
310 x = (x * std) + mean
311 return x
312
313 def cuda(self):
314 self.mean = self.mean.cuda()

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected