Ensure a C-contiguous input

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