Flattening layer

It is now possible to give a win shape for the flattening window
Use np for amax and exp, problems when using ca
added tanh