Hi all,
If I have a trained sequential model, say bigdl (of type KerasNet), then I can cast it to Sequential and call the add() method to add a custom layer as follows:
val sequential = bigdl.asInstanceOf[Sequential[Float]]
sequential.add(MyLayer())
However, if my bigdl model is more complicated, which is a graph of type Model[Float]:
val model = bigdl.asInstanceOf[Model[Float]]
Then how can I add that custom layer to the end of the model? My bigdl has only a single output. MyLayer() is used at prediction stage only, which transforms the 3-d output of the model to 2-d output, similar to ArgMax (so as to be usable with a NNModel).
I looked into the code of KerasNet (more specifically, keras/Model.scala, but I did not find any way to do this.
Thank you very much for your help.
Best,
Phuong