def METHOD_NAME(
    data: Any,
    dtype: Optional[torch.dtype] = None,
    device: Optional[Union[torch.device, str, int]] = None,
    requires_grad: Optional[bool] = None,
) -> torch.Tensor:
    if requires_grad is None:
        requires_grad = data.requires_grad if isinstance(data, torch.Tensor) else False
    return torch.as_tensor(data, dtype=dtype, device=device).requires_grad_(requires_grad)