inference function

Reverse-engineer the network