(self, x, sample_idx=None)
| 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() |
nothing calls this directly
no outgoing calls
no test coverage detected