import numpy as np
import torch


def is_number(value):
    return isinstance(value, (float, int)) or \
           (isinstance(value, np.ndarray) and (np.isscalar(value) or value.shape == ())) or \
           (isinstance(value, torch.Tensor) and value.shape == ())
