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

Why not having a constructor for Scope based on a Graph #385

Open
ramon-garcia opened this issue Oct 23, 2022 · 2 comments
Open

Why not having a constructor for Scope based on a Graph #385

ramon-garcia opened this issue Oct 23, 2022 · 2 comments

Comments

@ramon-garcia
Copy link
Contributor

Suppose that one, for instance, restores a graph from a file. Then one needs to add some elements. But one needs a Scope as an argument for building operations.

Tensorflow-java allows one to build a Scope from a Graph: see the example in the documentation. Why not in tensorflow-rust?

Best regards.

@Corallus-Caninus
Copy link
Contributor

Hi Ramon-Garcia,

You can get the mutable graph for a scope with the following getter method:
https://tensorflow.github.io/rust/src/tensorflow/scope.rs.html#329-332

You can then load the graph from disk into that graph using SavedModelBundle

as an example, I did something similar in the framework I'm trying to create (originally taken from example code in this repository)
https://github.com/Corallus-Caninus/Brains/blob/main/src/lib.rs#L444
notice also that I grab the ops out of the deserialized Graph by using the GraphAPI names.

I hope this helps!

@ramon-garcia
Copy link
Contributor Author

Thank you for the suggestion. But it looks counterintuitive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants