def METHOD_NAME(variables):
    if all(
        [type(var) is np.ndarray for var in variables]
    ):  # Infer if we're working with numpy arrays or torch tensors:
        MemType = 0
    elif pykeops.config.torch_found:
        import torch
        if all(
            [
                type(var) in [torch.Tensor, torch.nn.parameter.Parameter]
                for var in variables
            ]
        ):
            from pykeops.torch.utils import is_on_device
            VarsAreOnGpu = tuple(map(is_on_device, tuple(variables)))
            if all(VarsAreOnGpu):
                MemType = 1
            elif not any(VarsAreOnGpu):
                MemType = 0
            else:
                raise ValueError(
                    "At least two input variables have different memory locations (Cpu/Gpu)."
                )
        else:
            raise TypeError(
                "All variables should either be numpy arrays or torch tensors."
            )
    else:
        raise TypeError(
            "All variables should either be numpy arrays or torch tensors."
        )
    return MemType