Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serialization for Tensor #916

Open
tanlin2013 opened this issue Mar 31, 2021 · 6 comments
Open

Serialization for Tensor #916

tanlin2013 opened this issue Mar 31, 2021 · 6 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@tanlin2013
Copy link

In numpy, this can be acheived with *.npy or *.npz extension. Just wonder, given all supported backends in TensorNetwork, is there a unified way to save a bunch of tensors in a compressed and binary format file?

I have read the documentation for a while, but still couldn't find the saving functionality. Or perhaps I miss it somewhere :)

thanks!

@mganahl mganahl changed the title Question: Is there a way to save tensors? Serialization for Tensor Mar 31, 2021
@mganahl
Copy link
Collaborator

mganahl commented Mar 31, 2021

Hi @tanlin2013 , unfortunately this is currently not supported. The Node class supports serialization to HDF5 format using h5py. You could initialize a Node using the data-array in Tensor and save that, if this helps.

@mganahl mganahl added enhancement New feature or request help wanted Extra attention is needed labels Mar 31, 2021
@mganahl
Copy link
Collaborator

mganahl commented Mar 31, 2021

If you are interested in contributing, PRs are always welcome!!

@tanlin2013
Copy link
Author

Sounds nice! I would love to.

I have a small repo tnpy that is built on top of TensorNetwork. I'm actaully about to implement TDVP and DMT for real-time evo. That's why I need to store MPS generated by DMRG.

@mganahl
Copy link
Collaborator

mganahl commented Apr 6, 2021

nice! Let us know of any additional missing functionality, and we'll try to add it.

@jacksonwb
Copy link
Contributor

There is serialization support that exports networks to json, with array formats stored in their backend specified format. Currently the only backend that currently implements the the serialize/deserialize_tensor methods is the numpy backend, but this can be very easily added to other backends.

#824

@thanujkumar1999
Copy link

tf.io.serialize_tensor(
tensor, name=None
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants