jeremiedb commented on a change in pull request #8121: [R] Initializer fix and 
adjustments to RNN API
URL: https://github.com/apache/incubator-mxnet/pull/8121#discussion_r150357674
 
 

 ##########
 File path: R-package/R/initializer.R
 ##########
 @@ -4,11 +4,11 @@
 #' @param shape the shape of the array to be generated.
 #'
 mx.init.internal.default <- function(name, shape, ctx, allow.unknown=FALSE) {
-  if (endsWith(name, "bias")) return (mx.nd.zeros(shape, ctx))
-  if (endsWith(name, "gamma")) return (mx.nd.ones(shape, ctx))
-  if (endsWith(name, "beta")) return (mx.nd.zeros(shape, ctx))
-  if (endsWith(name, "moving_mean")) return (mx.nd.zeros(shape, ctx))
-  if (endsWith(name, "moving_var")) return (mx.nd.ones(shape, ctx))
+  if (endsWith(name, "bias")) return (mx.nd.zeros(shape))
 
 Review comment:
   Reason is that mx.nd.normal wasn't supported on GPU, at least when I did the 
test, so I made a hotfix to avoid cases when initialization would be attempted 
on GPU. 
   I can validate whether the operator  is now working. Or just assume it will 
eventually and bring back the ctx in the parameter. Anyway, it guess it's 
unlikely to call the initializer in another context than cpu. 

----------------------------------------------------------------
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

Reply via email to