thomelane commented on issue #12844: ERROR parameter summary of lstm layer URL: https://github.com/apache/incubator-mxnet/issues/12844#issuecomment-431418733 You can use `.summary()` for this example too @soeque1 . ```python import mxnet as mx from mxnet import gluon from mxnet.gluon import HybridBlock, nn, rnn class MyModel(gluon.HybridBlock): def __init__(self, vocab_size, num_embed, **kwargs): super(MyModel, self).__init__(**kwargs) with self.name_scope(): self.embed = nn.Embedding(input_dim=vocab_size, output_dim=num_embed) self.lstm = rnn.LSTM(20) self.out = nn.Dense(2) def hybrid_forward(self, F ,inputs): em_out = self.embed(inputs) lstm_out = self.lstm(em_out) return(self.out(lstm_out)) model = MyModel(vocab_size=20, num_embed=50) model.initialize(mx.init.Xavier()) data = mx.nd.array(np.random.randint(low=0, high=20, size=(2,3))) model.summary(data) ``` ``` -------------------------------------------------------------------------------- Layer (type) Output Shape Param # ================================================================================ Input (2, 3) 0 Embedding-1 (2, 3, 50) 1000 LSTM-2 (2, 3, 20) 5760 Dense-3 (2, 2) 122 MyModel-4 (2, 2) 0 ================================================================================ Parameters in forward computation graph, duplicate included Total params: 6882 Trainable params: 6882 Non-trainable params: 0 Shared params in forward computation graph: 0 Unique parameters in model: 6882 -------------------------------------------------------------------------------- ```
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
