Ejemplo n.º 1
0
 def next(self):
     batch = self.__next__()
     inks = [a[0] for a in batch]
     label = [a[1] for a in batch]
     inks = F.pad_sequence(inks)
     new_batch = list(zip(inks.data, label))
     return new_batch
Ejemplo n.º 2
0
    def __call__(self, x, test=False, finetune=False):
        """Invokes the forward propagation of BatchNormalization.

        BatchNormalization accepts additional arguments, which controlls three
        different running mode.

        Args:
            x (Variable): An input variable.
            test (bool): If ``True``, BatchNormalization runs in testing mode;
                it normalizes the input using precomputed statistics.
            finetune (bool): If ``True``, BatchNormalization runs in finetuning
                mode; it accumulates the input array to compute population
                statistics for normalization, and normalizes the input using
                batch statistics.

        If ``test`` and ``finetune`` are both ``False``, then BatchNormalization
        runs in training mode; it computes moving averages of mean and variance
        for evaluation during training, and normalizes the input using batch
        statistics.

        """
        self.use_batch_mean = not test or finetune
        self.is_finetune    = finetune
        return Function.__call__(self, x)
Ejemplo n.º 3
0
    def __call__(self, x, test=False, finetune=False):
        """Invokes the forward propagation of BatchNormalization.

        BatchNormalization accepts additional arguments, which controlls three
        different running mode.

        Args:
            x (Variable): An input variable.
            test (bool): If ``True``, BatchNormalization runs in testing mode;
                it normalizes the input using precomputed statistics.
            finetune (bool): If ``True``, BatchNormalization runs in finetuning
                mode; it accumulates the input array to compute population
                statistics for normalization, and normalizes the input using
                batch statistics.

        If ``test`` and ``finetune`` are both ``False``, then BatchNormalization
        runs in training mode; it computes moving averages of mean and variance
        for evaluation during training, and normalizes the input using batch
        statistics.

        """
        self.use_batch_mean = not test or finetune
        self.is_finetune = finetune
        return Function.__call__(self, x)
Ejemplo n.º 4
0
 def __call__(self, x, test=False, finetune=False,update_batch_estimations=True):
     self.use_batch_mean = not test
     self.is_finetune = finetune
     self.update_batch_estimations = update_batch_estimations
     return Function.__call__(self, x)