def train_batch(self, batch, optimizer):
    moved = []
    for feature in batch:
        moved.append(feature.to(self.device))
    (loss, acc) = self.model(*moved)
    loss.backward()
    if self.distributed:
        self.model.average_gradient()
    optimizer.step()
    return (loss.item(), acc.item())
def train_batch(self, batch, optimizer):
    moved = []
    for feature in batch:
        moved.append(feature.to(self.device))
    (loss, acc) = self.model(*moved)
    loss.backward()
    if self.distributed:
        self.model.average_gradient()
    optimizer.step()
    return (loss.item(), acc.item())