def _maybe_item(t):
    t = t.value
    return (t.item() if (isinstance(t, Tensor) and (t.numel() == 1)) else t)
def _maybe_item(t):
    t = t.value
    return (t.item() if (isinstance(t, Tensor) and (t.numel() == 1)) else t)