User-Defined Tensor Data Analysis