avoid vector copy/destruction in *_dim_ helper functions
avoid vector copy/destruction in *_dim_ helper functions

All of these take the dims by value. In a tight loop this is really
significant because of copy and free.

xzturn/caffe2,Yangqing/caffe2,xzturn/caffe2,Yangqing/caffe2,Yangqing/caffe2,xzturn/caffe2,xzturn/caffe2,Yangqing/caffe2,Yangqing/caffe2,xzturn/caffe2,caffe2/caffe2