fold
fold copied to clipboard
How do I get the root embedding tensors after training the model?
I perform sentiment analysis and I want to get the root embeddings of all trees after I train the whole training dataset of trees. I will use them all in a novel algorithm I've been developing.
What is the Python code for it? I want to obtain those root vectors (tensors) only, not the output scores for each sentiment label. I tried printing the names of all tensors through the following line of code:
[print(n.name) for n in tf.get_default_graph().as_graph_def().node]
However, I am not sure whether this code snippet prints the name of the root embedding tensor let alone exactly which one of them represents the root embedding.
After traversing each tree, you need to call Weaver.add_output() on the root to mark it as one of the output tensors. All output tensors with the same shape will be batched together into one big tensor, and you can get it with Loom.output_tensor(). If you have multiple tensors which have the same shape, but are conceptually different, you can keep them separate by creating TypeShapes with different tags.
Hope that helps,
-DeLesley
On Mon, May 20, 2019 at 1:09 PM cemrifki [email protected] wrote:
I perform sentiment analysis and I want to get the root embeddings of all trees after I train the whole training dataset of trees. I will use them all in a novel algorithm I've been developing.
What is the Python code for it? I want to obtain those root vectors (tensors) only, not the output scores for each sentiment label. I tried printing the names of all tensors through the following line of code:
[print(n.name) for n in tf.get_default_graph().as_graph_def().node
However, I am not sure whether this code snippet prints the name of the root embedding tensor let alone exactly which one of them represents the root embedding.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/tensorflow/fold/issues/101?email_source=notifications&email_token=ABQZWTMKHC64UFWZ65F32ITPWMAPPA5CNFSM4HOFAOR2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4GUZZ4BA, or mute the thread https://github.com/notifications/unsubscribe-auth/ABQZWTJ7AWZ2GDMQI42PSVDPWMAPPANCNFSM4HOFAORQ .
-- DeLesley Hutchins | Software Engineer | [email protected] | 505-206-0315