You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2018/11/01 05:32:20 UTC

[GitHub] ArmageddonKnight commented on a change in pull request #11364: [MXNET-490] Added OpenLSTMRNN together with benchmarks and Tensorboard callback routines.

ArmageddonKnight commented on a change in pull request #11364: [MXNET-490] Added OpenLSTMRNN together with benchmarks and Tensorboard callback routines.
URL: https://github.com/apache/incubator-mxnet/pull/11364#discussion_r229943448
 
 

 ##########
 File path: example/rnn-backends/word_lm/model.py
 ##########
 @@ -0,0 +1,152 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+"""
+Module: model
+
+Description: This file creates the computation graph for training purposes.
+"""
+
+import mxnet as mx
+
+
+def rnn(bptt, vocab_size, num_embed, nhid,
+        num_layers, dropout, batch_size, tied, backend):
+    """
+    Creates the computation graph for training.
+    """
+    # ==================================================================================================================
+    # Encoder
+    # ==================================================================================================================
+
+    data = mx.sym.Variable('data')
+    weight = mx.sym.Variable("encoder_weight", init=mx.init.Uniform(0.1))
+    embed = mx.sym.Embedding(data=data, weight=weight, input_dim=vocab_size,
+                             output_dim=num_embed, name='embed')
+
+    outputs = mx.sym.Dropout(embed, p=dropout)
+
+    # ==================================================================================================================
+    # RNN
+    # ==================================================================================================================
+
+    # stacked rnn layers
+
+    # Given below is the original source code, which we do argue makes bad use of CuDNN-RNN
+    # as there is no need to slice each layer apart, please refer to the open issue on github @
+    #     https://github.com/apache/incubator-mxnet/issues/10304
+    # The throughput measurements reported by MXNet speedometer showed that
+    # there is around 10~20% increase in throughput after all the layers have been fused.
+    # The implementation also messed up with the order of cell and hidden state,
+    # because according to the state order specified in rnn_cell.py (+L682),
+    # cell state should appear AFTER hidden state in FusedRNNCell. However, this has zero effect
+    # on the final training results because they are both zero-initialized.
+
+    states = []
+    state_names = []
+
+    # for i in range(num_layers):
+    #     prefix = 'lstm_l%d_' % i
 
 Review comment:
   @Roshrini I am terribly sorry for the late response. I do not this it is appropriate for me to remove this part of the comments because they are used to show the discrepencies between the original word language-modeling benchmark and the benchmark that I am using (i.e. it is deliberately left there for **comparison** purpose). 

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services