示例#1
0
文件: models.py 项目: tlhr/deeptime
    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)
示例#2
0
文件: models.py 项目: tlhr/deeptime
    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
示例#3
0
    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
示例#4
0
    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
示例#5
0
 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