from typing import Any
from typing import Optional
import torch


def _check_are_tensors(actual: Any, expected: Any) -> Optional[AssertionError]:
    """Checks if both inputs are tensors.

    Args:
        actual (Any): Actual input.
        expected (Any): Actual input.

    Returns:
        (Optional[AssertionError]): If check did not pass.
    """
    if not (isinstance(actual, torch.Tensor) and isinstance(expected, torch.Tensor)):
        return AssertionError(f"Both inputs have to be tensors, but got {type(actual)} and {type(expected)} instead.")

    return None