Sketch of inference function and tanh