def val_step(self, *inputs, **kwargs):
    'val_step() API for module wrapped by DistributedDataParallel.\n\n        This method is basically the same as\n        ``DistributedDataParallel.forward()``, while replacing\n        ``self.module.forward()`` with ``self.module.val_step()``.\n        It is compatible with PyTorch 1.1 - 1.5.\n        '
    if (('parrots' not in TORCH_VERSION) and (digit_version(TORCH_VERSION) >= digit_version('1.7')) and self.reducer._rebuild_buckets()):
        print_log('Reducer buckets have been rebuilt in this iteration.', logger='mmcv')
    if (('parrots' not in TORCH_VERSION) and (digit_version(TORCH_VERSION) >= digit_version('1.11.0'))):
        if self._check_sync_bufs_pre_fwd():
            self._sync_buffers()
    elif (getattr(self, 'require_forward_param_sync', False) and self.require_forward_param_sync):
        self._sync_params()
    if self.device_ids:
        (inputs, kwargs) = self.scatter(inputs, kwargs, self.device_ids)
        if (len(self.device_ids) == 1):
            output = self.module.val_step(*inputs[0], **kwargs[0])
        else:
            outputs = self.parallel_apply(self._module_copies[:len(inputs)], inputs, kwargs)
            output = self.gather(outputs, self.output_device)
    else:
        output = self.module.val_step(*inputs, **kwargs)
    if (('parrots' not in TORCH_VERSION) and (digit_version(TORCH_VERSION) >= digit_version('1.11.0'))):
        if self._check_sync_bufs_post_fwd():
            self._sync_buffers()
    if (torch.is_grad_enabled() and getattr(self, 'require_backward_grad_sync', False) and self.require_backward_grad_sync):
        if self.find_unused_parameters:
            self.reducer.prepare_for_backward(list(_find_tensors(output)))
        else:
            self.reducer.prepare_for_backward([])
    elif (('parrots' not in TORCH_VERSION) and (digit_version(TORCH_VERSION) > digit_version('1.2'))):
        self.require_forward_param_sync = False
    return output
val_step() API for module wrapped by DistributedDataParallel.

This method is basically the same as
``DistributedDataParallel.forward()``, while replacing
``self.module.forward()`` with ``self.module.val_step()``.
It is compatible with PyTorch 1.1 - 1.5.
def val_step(self, *inputs, **kwargs):
    'val_step() API for module wrapped by DistributedDataParallel.\n\n        This method is basically the same as\n        ``DistributedDataParallel.forward()``, while replacing\n        ``self.module.forward()`` with ``self.module.val_step()``.\n        It is compatible with PyTorch 1.1 - 1.5.\n        '
    if (('parrots' not in TORCH_VERSION) and (digit_version(TORCH_VERSION) >= digit_version('1.7')) and self.reducer._rebuild_buckets()):
        print_log('Reducer buckets have been rebuilt in this iteration.', logger='mmcv')
    if (('parrots' not in TORCH_VERSION) and (digit_version(TORCH_VERSION) >= digit_version('1.11.0'))):
        if self._check_sync_bufs_pre_fwd():
            self._sync_buffers()
    elif (getattr(self, 'require_forward_param_sync', False) and self.require_forward_param_sync):
        self._sync_params()
    if self.device_ids:
        (inputs, kwargs) = self.scatter(inputs, kwargs, self.device_ids)
        if (len(self.device_ids) == 1):
            output = self.module.val_step(*inputs[0], **kwargs[0])
        else:
            outputs = self.parallel_apply(self._module_copies[:len(inputs)], inputs, kwargs)
            output = self.gather(outputs, self.output_device)
    else:
        output = self.module.val_step(*inputs, **kwargs)
    if (('parrots' not in TORCH_VERSION) and (digit_version(TORCH_VERSION) >= digit_version('1.11.0'))):
        if self._check_sync_bufs_post_fwd():
            self._sync_buffers()
    if (torch.is_grad_enabled() and getattr(self, 'require_backward_grad_sync', False) and self.require_backward_grad_sync):
        if self.find_unused_parameters:
            self.reducer.prepare_for_backward(list(_find_tensors(output)))
        else:
            self.reducer.prepare_for_backward([])
    elif (('parrots' not in TORCH_VERSION) and (digit_version(TORCH_VERSION) > digit_version('1.2'))):
        self.require_forward_param_sync = False
    return output