def transform(self, loader): '''Apply the model on the provided data loader. Arguments: loader (DataLoader): the data you wish to transform ''' latent = [] for x, _ in loader: x = self.transformer.x(x) latent.append(x.mm(self.encoder_matrix.t())) return _cat(latent)
def transform(self, loader): '''Apply the model on the provided data loader. Arguments: loader (DataLoader): the data you wish to transform ''' self.eval() latent = [] for x, _ in loader: x = self.transformer.x(x) if self.use_cuda: x = x.cuda(non_blocking=self.non_blocking) y = self.encode(x) if self.cuda: y = y.cpu() latent.append(y) return _cat(latent).data
def transform(self, loader): '''Apply the model on the provided data loader. Arguments: loader (DataLoader): the data you wish to transform ''' self.eval() latent = [] for i, (x, _) in enumerate(loader): x = self.transformer.x( x, variable=True, volatile=True, requires_grad=False) if self.use_cuda: x = x.cuda(async=self.async) y = self.encode(x) if self.cuda: y = y.cpu() latent.append(y) return _cat(latent).data
def transform(self, loader): '''Apply the model on the provided data loader. Arguments: loader (DataLoader): the data you wish to transform ''' self.eval() latent = [] for i, (x, _) in enumerate(loader): x = self.transformer.x(x, variable=True, volatile=True, requires_grad=False) if self.use_cuda: x = x.cuda() try: x = self.batch_normalization(x) except AttributeError: pass y = self.encode(x) if self.cuda: y = y.cpu() latent.append(y) return _cat(latent).data
def __call__(self, **kwargs): selection = kwargs.setdefault('selection', None) feature_data, ref_data = self.bootstrap(selection=selection) ref_data = _cat(ref_data) dsc_data = self.discretizer(ref_data) return feature_data, ref_data, dsc_data