Here's a simpler problem that I believe is the same issue:

```
import mxnet as mx

json = """{
        "nodes":[
                {
                        "op":"null",
                        "name":"a",
                        "attrs":{},
                        "inputs":[]
                },
                {
                        "op":"null",
                        "name":"b",
                        "attrs":{},
                        "inputs":[]
                },
                {
                        "op":"_foreach",
                        "name":"foreach",
                        "attrs":{
                                "in_data_locs":"[0,1]",
                                "in_state_locs":"[]",
                                "num_args":"3",
                                "num_out_data":"2",
                                "num_outputs":"2",
                                "remain_locs":"[]"
                        },
                        "inputs":[[0,0,0],[1,0,0]],
                        "subgraphs":[
                                {
                                        "nodes":[
                                                {
                                                        "op":"null",
                                                        "name":"inner_a",
                                                        "inputs":[]
                                                },
                                                {
                                                        "op":"null",
                                                        "name":"inner_b",
                                                        "inputs":[]
                                                },
                                                {
                                                        "op":"identity",
                                                        "name":"id_a",
                                                        "inputs":[[0,0,0]]
                                                },
                                                {
                                                        "op":"identity",
                                                        "name":"id_b",
                                                        "inputs":[[1,0,0]]
                                                }                               
                
                                        ],
                                        "arg_nodes":[0,1],
                                        "heads":[[3,0,0],[2,0,0]]
                                }
                        ]
                }
        ],
        "arg_nodes":[0,1],
        "heads":[[2,0,0], [2,1,0]],
        "attrs":{
                "mxnet_version":[
                        "int",
                        10300
                ]
        }
}"""

sym = mx.sym.load_json(json)
print(sym.infer_shape(a=(3,2), b=(3,5)))
```

This prints:

```
([(3, 2), (3, 5)], [(3, 2), (3, 5)], [])
```

But it should print:

```
([(3, 2), (3, 5)], [(3, 5), (3, 2)], [])
```

Changing the value of `"heads":[[3,0,0],[2,0,0]]` to 
`"heads":[[2,0,0],[3,0,0]]` does nothing! It should determine the order of 
outputs of the inner foreach op.

[ Full content available at: 
https://github.com/apache/incubator-mxnet/issues/12760 ]
This message was relayed via gitbox.apache.org for [email protected]

Reply via email to