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