def _infer(self, args, dataloader, json_metas, log_every=1, verbose=True):
    logits = []
    pbar = dataloader
    metas = []
    for (count, batch) in enumerate(pbar):
        (batch_metas, features) = self.get_features(batch)
        logit = self.infer_batch(features)
        logits.append(logit)
        metas.extend(batch_metas)
        if (verbose and ((count % log_every) == 0)):
            print('inference iter ({}/{}) saving caches'.format(count, len(dataloader)))
            logits = torch.cat(logits, dim=0)
            self.save_inference(args, logits, metas, json_metas)
            logits = []
            metas = []
    if (len(metas) > 0):
        logits = torch.cat(logits, dim=0)
        self.save_inference(args, logits, metas, json_metas)
    print('done: inference iter ({}/{}) saving caches'.format(count, len(dataloader)))
    return (logits, metas)
def _infer(self, args, dataloader, json_metas, log_every=1, verbose=True):
    logits = []
    pbar = dataloader
    metas = []
    for (count, batch) in enumerate(pbar):
        (batch_metas, features) = self.get_features(batch)
        logit = self.infer_batch(features)
        logits.append(logit)
        metas.extend(batch_metas)
        if (verbose and ((count % log_every) == 0)):
            print('inference iter ({}/{}) saving caches'.format(count, len(dataloader)))
            logits = torch.cat(logits, dim=0)
            self.save_inference(args, logits, metas, json_metas)
            logits = []
            metas = []
    if (len(metas) > 0):
        logits = torch.cat(logits, dim=0)
        self.save_inference(args, logits, metas, json_metas)
    print('done: inference iter ({}/{}) saving caches'.format(count, len(dataloader)))
    return (logits, metas)