Creating tensors from NumPy arrays