mxnet icon indicating copy to clipboard operation
mxnet copied to clipboard

Align repr() function for rnn cell and rnn layer of Gluon

Open zixuanweeei opened this issue 5 years ago • 3 comments

Description

Align the repr() function of RNN cell with RNN layer in Gluon RNN API.

https://github.com/apache/incubator-mxnet/blob/58cbd65cfe98e50da36303c5f2adc65358d3a0b8/python/mxnet/gluon/rnn/rnn_layer.py#L121

In RNN API, we often initialize the i2h weights with shape (num_gates * hidden_dim, input_dim). So shape[0] will get the size as hidden dimension times the number of gates. The repr() function should intend to print the information such as mapping the input dimension to the hidden/output dimension in the line above. In the RNN layers' API, it gets the right dimension, while it is not true in the cells' API.

Checklist

Essentials

Please feel free to remove inapplicable items for your PR.

  • [x] Changes are complete (i.e. I finished coding on this PR)
  • [x] To the best of my knowledge, examples are either not affected by this change, or have been fixed to be compatible with this change

Changes

  • [x] Mapping input dim to hidden dim, instead of hidden dim times number of gates, for rnn cells.

Comments

  • Is this issue critical for v1.6.x?

@ciyongch @pengzhao-intel @TaoLv

zixuanweeei avatar Jan 14 '20 08:01 zixuanweeei

Looks good, as it's just a helper message for LSTM/GRU cell, not related to the functionality. I don't think it's necessary for v1.6.x. Please re-trigger the CI.

ciyongch avatar Jan 15 '20 01:01 ciyongch

Looks good, as it's just a helper message for LSTM/GRU cell, not related to the functionality. I don't think it's necessary for v1.6.x. Please re-trigger the CI.

Thanks for the review. Let's wait for the CI passing.

zixuanweeei avatar Jan 15 '20 01:01 zixuanweeei

@szha Is this change good to you?

TaoLv avatar Jan 15 '20 01:01 TaoLv