[GitHub] piiswrong commented on a change in pull request #7352: add Sequential compatibility to rnn layers

2017-08-09 Thread git
piiswrong commented on a change in pull request #7352: add Sequential 
compatibility to rnn layers
URL: https://github.com/apache/incubator-mxnet/pull/7352#discussion_r132317845
 
 

 ##
 File path: python/mxnet/gluon/rnn/rnn_layer.py
 ##
 @@ -286,6 +293,8 @@ class RNN(_RNNLayer):
 The recurrent state's shape is `(num_layers, batch_size, num_hidden)`.
 If `bidirectional` is True, state shape will instead be
 `(2*num_layers, batch_size, num_hidden)`
+If input recurrent state is None, zeros are used as default begin 
states,
 
 Review comment:
   Recurrent state shape -> Recurrent state.
   
   and change the beginning sentence to The recurrent states is an NDArray with 
shape xxx.
 

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


With regards,
Apache Git Services


[GitHub] piiswrong commented on a change in pull request #7352: add Sequential compatibility to rnn layers

2017-08-09 Thread git
piiswrong commented on a change in pull request #7352: add Sequential 
compatibility to rnn layers
URL: https://github.com/apache/incubator-mxnet/pull/7352#discussion_r132317845
 
 

 ##
 File path: python/mxnet/gluon/rnn/rnn_layer.py
 ##
 @@ -286,6 +293,8 @@ class RNN(_RNNLayer):
 The recurrent state's shape is `(num_layers, batch_size, num_hidden)`.
 If `bidirectional` is True, state shape will instead be
 `(2*num_layers, batch_size, num_hidden)`
+If input recurrent state is None, zeros are used as default begin 
states,
 
 Review comment:
   Recurrent state shape -> Recurrent state.
   
   and change the beginning sentence to The recurrent states is an NDArray with 
shape xxx.
   
   same for input and output
 

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


With regards,
Apache Git Services


[GitHub] piiswrong commented on a change in pull request #7352: add Sequential compatibility to rnn layers

2017-08-09 Thread git
piiswrong commented on a change in pull request #7352: add Sequential 
compatibility to rnn layers
URL: https://github.com/apache/incubator-mxnet/pull/7352#discussion_r132316721
 
 

 ##
 File path: python/mxnet/gluon/rnn/rnn_layer.py
 ##
 @@ -487,6 +502,7 @@ class GRU(_RNNLayer):
 >>> input = mx.nd.random_uniform(shape=(5, 3, 10))
 >>> h0 = mx.nd.random_uniform(shape=(3, 3, 100))
 >>> output, hn = layer(input, h0)
+>>> output = layer(input) # zeros are used as begin state
 
 Review comment:
   ```
>>> input = mx.nd.random_uniform(shape=(5, 3, 10))
>>> # by default zeros are used as begin state
>>> output = layer(input)
>>> # manually specify begin state.
 >>> h0 = mx.nd.random_uniform(shape=(3, 3, 100))
 >>> output, hn = layer(input, h0)
   ```
 

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


With regards,
Apache Git Services


[GitHub] piiswrong commented on a change in pull request #7352: add Sequential compatibility to rnn layers

2017-08-09 Thread git
piiswrong commented on a change in pull request #7352: add Sequential 
compatibility to rnn layers
URL: https://github.com/apache/incubator-mxnet/pull/7352#discussion_r132316721
 
 

 ##
 File path: python/mxnet/gluon/rnn/rnn_layer.py
 ##
 @@ -487,6 +502,7 @@ class GRU(_RNNLayer):
 >>> input = mx.nd.random_uniform(shape=(5, 3, 10))
 >>> h0 = mx.nd.random_uniform(shape=(3, 3, 100))
 >>> output, hn = layer(input, h0)
+>>> output = layer(input) # zeros are used as begin state
 
 Review comment:
   ???
>>> input = mx.nd.random_uniform(shape=(5, 3, 10))
>>> # by default zeros are used as begin state
>>> output = layer(input)
>>> # manually specify begin state.
 >>> h0 = mx.nd.random_uniform(shape=(3, 3, 100))
 >>> output, hn = layer(input, h0)
   ???
 

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


With regards,
Apache Git Services


[GitHub] piiswrong commented on a change in pull request #7352: add Sequential compatibility to rnn layers

2017-08-05 Thread git
piiswrong commented on a change in pull request #7352: add Sequential 
compatibility to rnn layers
URL: https://github.com/apache/incubator-mxnet/pull/7352#discussion_r131535019
 
 

 ##
 File path: python/mxnet/gluon/rnn/rnn_layer.py
 ##
 @@ -165,8 +207,10 @@ def forward(self, inputs, states):
 self.i2h_weight[i].shape = (self._gates*self._hidden_size, 
inputs.shape[2])
 self.i2h_weight[i]._finish_deferred_init()
 if inputs.context.device_type == 'gpu':
-return self._forward_gpu(inputs, states)
-return self._forward_cpu(inputs, states)
+out = self._forward_gpu(inputs, states) # output, state
+out = self._forward_cpu(inputs, states)
 
 Review comment:
   ???
 

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


With regards,
Apache Git Services


[GitHub] piiswrong commented on a change in pull request #7352: add Sequential compatibility to rnn layers

2017-08-05 Thread git
piiswrong commented on a change in pull request #7352: add Sequential 
compatibility to rnn layers
URL: https://github.com/apache/incubator-mxnet/pull/7352#discussion_r131535006
 
 

 ##
 File path: python/mxnet/gluon/rnn/rnn_layer.py
 ##
 @@ -151,10 +151,52 @@ def begin_state(self, batch_size=0, func=ndarray.zeros, 
**kwargs):
 states.append(func(name='%sh0_%d'%(self.prefix, i), **info))
 return states
 
-def forward(self, inputs, states):
+def forward(self, inputs, states=None):
+"""Performs the RNN transformation for all time steps.
 
 Review comment:
   This is not visible. Put it in the class doc string of each layer
 

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


With regards,
Apache Git Services