gf: generalize matrix_proxy to tensor and clean