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

Reading a tensor from file in python which was saved using C++ #27390

Closed
dibya-pati opened this issue Apr 1, 2019 · 10 comments
Closed

Reading a tensor from file in python which was saved using C++ #27390

dibya-pati opened this issue Apr 1, 2019 · 10 comments
Assignees
Labels
comp:ops OPs related issues stale This label marks the issue/pr stale - to be closed automatically if no activity stat:awaiting response Status - Awaiting response from author type:docs-bug Document issues

Comments

@dibya-pati
Copy link

dibya-pati commented Apr 1, 2019

I'm having trouble reading/interpreting a tensor from a file using read_file() operation in Python. The tensor was saved using Save() ops in tensorflow CC API. I can read the underlying byte encoded tensor, but find no methods to convert that back to float(original content of the tensor). I have tried decode_raw() in python but it complaints about of not being of proper multiple of 4.
The above tensor comprises of a 3 channel nd array with float contents. Would appreciate any help in deciphering the content
More precisely would really appreciate on some details on how Save() ops in tensorflow CC API works?

@muddham muddham self-assigned this Apr 2, 2019
@muddham muddham added type:support Support issues comp:ops OPs related issues labels Apr 2, 2019
@muddham
Copy link

muddham commented Apr 2, 2019

@dibya-pati This question is better asked on StackOverflow since it is not a bug or feature request. There is also a larger community that reads questions there.If you think we've misinterpreted a bug, please comment again with a clear explanation, as well as all of the information requested in the issue template. Thanks!

@dibya-pati
Copy link
Author

@muddham Thanks for the reply. I believe its more to do on documentation of an API . Its not a bug,But there are no documentation on how the tensor is encoded before writing to the disk , hence there is no way to understand how to decode it from the file using a different method other than Restore() in CC API. Thanks for the suggestion, I would definitely put a stackoverflow question But I would really appreciate if you could point out to me if there are any existing documentation of CC Save() API

@muddham muddham assigned jvishnuvardhan and unassigned muddham Apr 4, 2019
@jvishnuvardhan
Copy link
Contributor

@dibya-pati Could you provide a simple code to reproduce your issue? Thanks!

@jvishnuvardhan jvishnuvardhan added the stat:awaiting response Status - Awaiting response from author label Apr 4, 2019
@dibya-pati
Copy link
Author

Hi, Its not an issue, but documentation request i.e. I can't figure out from the documentation how the tensors are encoded before getting written to disk using Save() in TF CC API, So, I don't know how to read the written tensor file in python. Sorry, I couldn't get some time write a snippet to demonstrate this. But , if someone just could point to some example or any material that shows how its encoded, that will be it. I'll try to put a code snippet to better explain the problem

@jvishnuvardhan jvishnuvardhan added stat:awaiting tensorflower Status - Awaiting response from tensorflower type:docs-bug Document issues and removed stat:awaiting response Status - Awaiting response from author type:support Support issues labels Apr 19, 2019
@Saduf2019
Copy link
Contributor

@dibya-pati please confirm if the issue still persist

@MarkDaoust
Copy link
Member

MarkDaoust commented Feb 19, 2020

Hi @dibya-pati,

Personally, if I had to get a tensor-value from a cpp program to a python program I'd try:
serialize-tensor and parse-tensor first, since these have clear python implementations: serialize_tensor, and parse_tensor.

I'm no expert on the internals of tf-cpp or checkpoints, but I think ops::Save, and ops:SaveV2 are part of the checkpoint system.

@tensorflowbutler tensorflowbutler removed the stat:awaiting tensorflower Status - Awaiting response from tensorflower label Feb 21, 2020
@dibya-pati
Copy link
Author

I'm still waiting for some API documentation on Save() ops in CC Tf. If you have some documentation please point me to it.

@rmothukuru
Copy link
Contributor

@dibya-pati,
Sorry for the delayed response. Can you please refer to the documentation of Save and SaveV2 and let us know if this is what your are looking for? Thanks!

@rmothukuru rmothukuru self-assigned this Apr 26, 2021
@rmothukuru rmothukuru added the stat:awaiting response Status - Awaiting response from author label Apr 26, 2021
@google-ml-butler
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you.

@google-ml-butler google-ml-butler bot added the stale This label marks the issue/pr stale - to be closed automatically if no activity label May 3, 2021
@google-ml-butler
Copy link

Closing as stale. Please reopen if you'd like to work on this further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:ops OPs related issues stale This label marks the issue/pr stale - to be closed automatically if no activity stat:awaiting response Status - Awaiting response from author type:docs-bug Document issues
Projects
None yet
Development

No branches or pull requests

7 participants