Allow dynamic batch sizes in all the layers

In practical applications, many users need to feed data of varying batch sizes into the network. The detailed design of this PR was formed [in the discussion](https://github.com/BVLC/caffe/issues/119#issuecomment-36324692) of #119.

#189 may involved similar but more complex blob memory operations, but this PR only focuses on batch size.

Many but not all the layers have passed the dynamic batch sizes test cases right now.