anirudhacharya commented on issue #10359: Correct way to detect JSON file 
contains MXNet model
URL: 
https://github.com/apache/incubator-mxnet/issues/10359#issuecomment-377993495
 
 
   Here is a potential solution to this problem, without having any 
restrictions on the filename of the json file.
   
   The following is a sample json file that was obtained after serializing an 
mxnet symbol graph. 
   
   ```
   {
     "nodes": [
       {
         "op": "null", 
         "name": "a", 
         "inputs": []
       }, 
       {
         "op": "null", 
         "name": "b", 
         "inputs": []
       }, 
       {
         "op": "elemwise_mul", 
         "name": "_mul5", 
         "inputs": [[0, 0, 0], [1, 0, 0]]
       }, 
       {
         "op": "dot", 
         "name": "dot5", 
         "inputs": [[0, 0, 0], [1, 0, 0]]
       }, 
       {
         "op": "elemwise_add", 
         "name": "_plus11", 
         "inputs": [[2, 0, 0], [3, 0, 0]]
       }, 
       {
         "op": "Reshape", 
         "name": "reshape6", 
         "attrs": {"shape": "(1, 4)"}, 
         "inputs": [[4, 0, 0]]
       }
     ], 
     "arg_nodes": [0, 1], 
     "node_row_ptr": [0, 1, 2, 3, 4, 5, 6], 
     "heads": [[5, 0, 0]], 
     "attrs": {"mxnet_version": ["int", 10200]}
   }
   ```
   
   I have checked with a couple of other serialized graphs and all of them have 
this particular attribute in their json - 
   ```
   "attrs": {"mxnet_version": ["int", 10200]}
   ```
   We could possibly use the presence of this attribute in the json file to 
verify if it is an MXNet Symbol graph or not. I doubt Keras models will contain 
that particular attribute in its json.

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