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
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)
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)