def METHOD_NAME(self, sample, callbacks, ):
    y_mini_batch_outputs, y_mini_batch_inputs = {}, {}
    hook_handles = []
    intermediate_layers = self._intermediate_layers(self._model)
    for name, intermediate_layer in intermediate_layers.items():
        def hook(module, input, output, name):
            # y_mini_batch_outputs.append(output)
            # y_mini_batch_inputs.append(input[0])
            y_mini_batch_outputs[name] = output
            y_mini_batch_inputs[name] = input[0]
        hook_fn = partial(hook, name=name)
        handle = intermediate_layer.register_forward_hook(hook_fn)
        hook_handles.append(handle)
    with torch.no_grad():
        y_mini_batch_inputs.clear()
        y_mini_batch_outputs.clear()
        output = self._model(sample)
        for callback in callbacks:
            callback(y_mini_batch_inputs, y_mini_batch_outputs, 0)
    for handle in hook_handles:
        handle.remove()
    return output