Dump the intermediate compute result


we can get the result using get_output function, but how do we get the intermediate result of computation? such as in one topi’s tvm::compute, I want to know its inputs[0], inputs[1] …'s value.


Ah, good question. There’s an easy way and a hard way to do this. The hard way is to hack the runtime to make get_input also return non-variable tensors. The easy way is to

from nnvm import sym

data = sym.Variable('data')
a = sym.dense(data, units=42)
b = sym.softmax(a)
net = sym.Group(b, a)

now, you can do get_output(1) and it’ll return the value of intermediate output a.


nice hack. Thanks for replying.