Add broadcasting support for copy_, simplify code generation by moving a lot of currently generated code to expand_utils.
diff --git a/generic/THCTensor.c b/generic/THCTensor.c
index 57ff028..443b6bc 100644
--- a/generic/THCTensor.c
+++ b/generic/THCTensor.c
@@ -303,8 +303,8 @@
 
 int THCTensor_(expand)(THCState *state, THCTensor *r, THCTensor *tensor, THLongStorage *sizes, int raiseErrors) 
 {
-  THArgCheck(THCTensor_(nDimension)(state, tensor) > 0, 0, "can't expand an empty tensor");
   if (raiseErrors) {
+    THArgCheck(THCTensor_(nDimension)(state, tensor) > 0, 0, "can't expand an empty tensor");
     THArgCheck(THLongStorage_size(sizes) >= THCTensor_(nDimension)(state, tensor), 1,
                "the number of sizes provided must be greater or equal to the "
                "number of dimensions in the tensor");