Gluon performance compared with low level api


#1

Do you have any performance comparison between Gluon and low level API?

I’m using Gluon Sequential layers with gluon.rnn.LSTM and gluon.nn.Dense layers and it’s much slower than using mx.rnn.LSTMCell and mx.sym.FullyConnected cell.

Meanwhile the accuracy is much worse with same learning_rate and epochs. Is it expected or should I check whether I did something wrong?

Edit: Actually I would like to know the benefit choosing Gluon to build a model and train, over using Module to build a model and train. It seems they provide quite close/similar intermediate level APIs while Module has handy fit/predict functions.


#2

Could you post your code?


#3

Thanks for reply. I could not post the whole piece because of protection in my network.
But it’s very simple structure with LSTM + FullConnection Layer.
I consistently observed this performance/accuracy difference between Gluon and symbolic version. Since I used LSTM layer in GLuon, it can’t be turned into HybridSequential either. My guess is that the problem to be solved is very trivial so Symbolic computation is good at this.
But I’m not sure so I would like to get some expert advises.

My major concern now is that Gluon usage since I didn’t find it very appealing, usage level or performance level, comparing with Sym+Module.


#4

It could be due to your network is very small and gluon has a little more overhead.

Gluon is more flexible when you want to do dynamic graphs.