Dense to Sparse Tensors

Is there a way to convert dense tensors to sparse tensors without having to extract every value and coordinate and recreating the dense tensor as a sparse one?

i just checked the code, there isn’t a good way to do this.