thirdwing commented on a change in pull request #8118: [R] various small 
changes for efficiency and robustness in R package
URL: https://github.com/apache/incubator-mxnet/pull/8118#discussion_r150569510
 
 

 ##########
 File path: R-package/R/model.R
 ##########
 @@ -589,27 +587,20 @@ predict.MXFeedForwardModel <- function(model, X, ctx = 
NULL, array.batch.size =
 mx.model.load <- function(prefix, iteration) {
   symbol <- mx.symbol.load(path.expand(paste0(prefix, "-symbol.json")))
   save.dict <- mx.nd.load(path.expand(sprintf("%s-%04d.params", prefix, 
iteration)))
-  names <- names(save.dict)
-  arg.index <- as.integer(mx.util.filter.null(lapply(1:length(names), 
function(i) {
-    if (startsWith(names[[i]], "arg:")) i else NULL
-  })))
-  aux.index <- as.integer(mx.util.filter.null(lapply(1:length(names), 
function(i) {
-    if (startsWith(names[[i]], "aux:")) i else NULL
-  })))
+  nms <- names(save.dict)
+  
+  arg.index <- startsWith(nms, "arg:")
 
 Review comment:
   I don't think this returns the same result with the original code.

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