java
java copied to clipboard
we need Embeddings Lookup this method
Hi : I wanna to invoke tf.nn.embedding_lookup to make embedding layer ,but the java version has not these part code.please make it real work in java ? thank you ,
FYI, it looks like the C++ API of PyTorch implements this functionality, which we can easily use from Java: https://github.com/bytedeco/javacpp-presets/blob/master/pytorch/src/gen/java/org/bytedeco/pytorch/EmbeddingImpl.java
Hi @mullerhai , did you tried to use tf.gather instead? According to TF documentation, embedding_lookup is just a generalization of gather.
FYI, it looks like the C++ API of PyTorch implements this functionality, which we can easily use from Java: https://github.com/bytedeco/javacpp-presets/blob/master/pytorch/src/gen/java/org/bytedeco/pytorch/EmbeddingImpl.java @karllessard @saudet Hi ,I think we can read this and implement it in our code https://github.com/eaplatanios/tensorflow_scala/blob/master/modules/api/src/main/scala/org/platanios/tensorflow/api/learn/layers/Embedding.scala
If you could port that to Java, I'm sure we will want to merge this, yes.
ohh , maybe let me try to do this
Thanks @mullerhai ,
Again, the "happy path" of embedding_lookup (getting raw embeddings from a single tensor) can be replaced by a single call to tf.gather. But if you could write/port a wrapper that does also the fancy stuff (partitioning, norm, transform, ...), that would be certainly a great addition to our Java framework.
Thanks @mullerhai ,
Again, the "happy path" of
embedding_lookup(getting raw embeddings from a single tensor) can be replaced by a single call totf.gather. But if you could write/port a wrapper that does also the fancy stuff (partitioning, norm, transform, ...), that would be certainly a great addition to our Java framework.
yeah, if the tf java framework has embedding look up method then we will have embedding layer, it will benefit for all users
Talking of embedding layers… @JimClarke5 , is this something you have worked on as part of the first phase for layers?
Exactly what do you mean by embedding layers? The Sequential model can contain a network of layers if that is what you mean.
I have not worked on layers for the simpler models, the plan is to get the basic model plumbing accepted, then add more layers.
Also, I have not tackled saving the model in a SavedModelBundle yet.
There is a lot of work yet for models and layers.
Jim
On Feb 14, 2022, at 6:07 PM, Karl Lessard @.***> wrote:
Talking of embedding layers… @JimClarke5 , is this something you have worked on as part of the first phase for layers?
— Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you were mentioned.
Yes I was asking if you’ve already started to port the Keras embedding layer, to make sure we are not duplicating the efforts here.
I haven’t started it. There is some plumbing for Layers you will need, like the Layer Interface and BaseLayer abstract class.
Jim
On Feb 15, 2022, at 2:00 PM, Karl Lessard @.***> wrote:
Yes I was asking if you’ve already started to port the Keras embedding layer, to make sure we are not duplicating the efforts here.
— Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you were mentioned.