3
$\begingroup$

There is a trained net:model.zip

enter image description here

Using Python to make prediction:

import mxnet as mx
from mxnet import nd
import numpy as np
##############   Re-importing the net  ##############
print("##############   Re-importing the net  ##############")
from collections import namedtuple
sym = mx.symbol.load('JoinModel-symbol.json') 
mod=mx.mod.Module(symbol=sym,data_names=['data0','data1'])
mod.bind(data_shapes=[('data0',(1,523)),('data1',(1,128))])
mod.load_params('JoinModel-0000.params')
Batch=namedtuple('Batch',['data'])
x = nd.array([np.arange(523)])
y = nd.array([np.arange(128)])
mod.forward(Batch([x,y]),is_train=False)
print mod.get_outputs()
print sym.list_outputs()

enter image description here

However in Mathematica 11.3.0:

net = Import["JoinModel-symbol.json", "MXNet"];
net[<|"data0" -> Range[0, 523-1], "data1" -> Range[0, 128-1]|>]

It gives

enter image description here

The Output1 is same as Python gives, but Output2 is not.

I make sure the results given by Python is right. I have checked it with Gluon and C++.

So what's wrong in Mathematica?

Even set NetEvaluationMode -> "Test" can not change the result.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.