def eval_step(self):
    self.last_batch = None
    with Timer() as timer:
        sample = next(self.data_iterator)
    assert (isinstance(sample, dict) and ('input' in sample) and ('target' in sample)), (f"Returned sample [{sample}] is not a map with 'input' and" + "'target' keys")
    target = sample['target']
    if self.use_gpu:
        sample = recursive_copy_to_gpu(sample, non_blocking=True)
    torch_amp_context = (torch.cuda.amp.autocast() if (self.amp_type == AmpType.PYTORCH) else contextlib.suppress())
    with torch.no_grad(), torch_amp_context:
        output = self.model(sample['input'])
        local_loss = self.compute_loss(output, sample)
        loss = local_loss.detach().clone()
        self.check_inf_nan(loss)
        self.losses.append((loss.data.cpu().item() * target.size(0)))
        self.update_meters(output, sample)
    self.last_batch = LastBatchInfo(loss=loss, output=output, target=target, sample=sample, step_data={'sample_fetch_time': timer.elapsed_time})
def eval_step(self):
    self.last_batch = None
    with Timer() as timer:
        sample = next(self.data_iterator)
    assert (isinstance(sample, dict) and ('input' in sample) and ('target' in sample)), (f"Returned sample [{sample}] is not a map with 'input' and" + "'target' keys")
    target = sample['target']
    if self.use_gpu:
        sample = recursive_copy_to_gpu(sample, non_blocking=True)
    torch_amp_context = (torch.cuda.amp.autocast() if (self.amp_type == AmpType.PYTORCH) else contextlib.suppress())
    with torch.no_grad(), torch_amp_context:
        output = self.model(sample['input'])
        local_loss = self.compute_loss(output, sample)
        loss = local_loss.detach().clone()
        self.check_inf_nan(loss)
        self.losses.append((loss.data.cpu().item() * target.size(0)))
        self.update_meters(output, sample)
    self.last_batch = LastBatchInfo(loss=loss, output=output, target=target, sample=sample, step_data={'sample_fetch_time': timer.elapsed_time})