Incubator-mxnet: graph.viz broken - returns Error in symbol$as.json : $ operator is invalid for atomic vectors

Created on 8 Mar 2017  路  5Comments  路  Source: apache/incubator-mxnet

For bugs or installation issues, please provide the following information.
The more information you provide, the more likely people will be able to help you.

Environment info

Operating System:Windows 7 / RHEL 7

Compiler:g++

Package used (Python/R/Scala/Julia):R

MXNet version:0.9.4

Or if installed from source:

MXNet commit hash (git rev-parse HEAD):

If you are using python package, please provide

Python version and distribution:

If you are using R package, please provide

R sessionInfo():R version 3.3.1 (2016-06-21)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C LC_TIME=English_United States.1252

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] mxnet_0.9.4 mlbench_2.1-1

loaded via a namespace (and not attached):
[1] htmlwidgets_0.8 magrittr_1.5 rsconnect_0.7 htmltools_0.3.5 visNetwork_1.0.4 tools_3.3.1 Rcpp_0.12.9
[8] codetools_0.2-15 stringi_1.1.2 digest_0.6.12 stringr_1.2.0 jsonlite_1.3

Error Message:

Please paste the full error message, including stack trace.
Error in symbol$as.json : $ operator is invalid for atomic vectors

Minimum reproducible example

I try :
http://mxnet.io/tutorials/r/fiveMinutesNeuralNetwork.html

require(mlbench)

Loading required package: mlbench

require(mxnet)

Loading required package: mxnet

Loading required package: methods

data(Sonar, package="mlbench")

Sonar[,61] = as.numeric(Sonar[,61])-1
train.ind = c(1:50, 100:150)
train.x = data.matrix(Sonar[train.ind, 1:60])
train.y = Sonar[train.ind, 61]
test.x = data.matrix(Sonar[-train.ind, 1:60])
test.y = Sonar[-train.ind, 61]

mx.set.seed(0)
model <- mx.mlp(train.x, train.y, hidden_node=10, out_node=2, out_activation="softmax",
num.round=20, array.batch.size=15, learning.rate=0.07, momentum=0.9,
eval.metric=mx.metric.accuracy)

graph.viz(model$symbol$as.json())

Steps to reproduce

or if you are running standard examples, please provide the commands you have run that lead to the error.

graph.viz(model$symbol$as.json())

What have you tried to solve it?

  1. different parameters and saving the variable out, but no luck

Most helpful comment

Hi, the graph.viz now takes the symbol as argument. You can try graph.viz(model$symbol). This allowed to add the option to display the shapes of the outputs following each operator. However, I noticed DiagrammeR was not loaded by the NAMESPACE, so I'm not sure if you're having the latest version.

All 5 comments

Hi, the graph.viz now takes the symbol as argument. You can try graph.viz(model$symbol). This allowed to add the option to display the shapes of the outputs following each operator. However, I noticed DiagrammeR was not loaded by the NAMESPACE, so I'm not sure if you're having the latest version.

Wow ! thanks so much ! changing it to graph.viz(model$symbol) worked!

one more question - thanks again for the help; I was able to use shiny with visNetworkOutput in 0.9.3 on windows with graph.viz because that was what I had for binaries installed.

I also had 0.9.4 compiled from source on Red Hat, because I couldn't get the binaries otherwise ; and noticed some differences. I do see a new type paramameter for vis in 0.9.4 ,

I'm hoping vis.js will be there going forward as I use visNetwork frequently with shiny? I noticed it wasn't the default in the new version. DiagrammerR uses visNetwork, but still....

Hello, I can't make any promise regarding the graph.viz features as I'm not an oficial maintainer of the package, I actually just added some features to it following bugs with an update to DiagrammeR. That being said, I personnally appreciate having both options, since I find cleaner the DiagrammeR rendering of LSTM/RNN models while the vis.js can be helpful for very deep networks.

You can get the latest pre-compiled package for Windows (CPU only) from here, by the time Drat is updated:

install.packages("https://github.com/jeremiedb/mxnet_winbin/raw/master/mxnet.zip", repos = NULL)

perfect thanks again!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

realbns2008 picture realbns2008  路  3Comments

ranti-iitg picture ranti-iitg  路  3Comments

phunterlau picture phunterlau  路  3Comments

sbodenstein picture sbodenstein  路  3Comments

Ajoo picture Ajoo  路  3Comments