Ensure a C-contiguous input for ImgActs

Both ImgActs and WeightActs require hidacts to be C-contiguous, but it is not guaranteed in code. This could lead to runtime exception.
resolve #1220