   src = THCudaTensor_newContiguous(src);
 
   if(dimension == THCudaTensor_nDimension(src)-1) {
-    THCudaTensor_transformReduceInnermostDim(self, src, unary_op, binary_op, init);
+    THCudaTensor_transformReduceInnermostDim(self, src, unary_op, init, binary_op);
   } else {
-    THCudaTensor_transformReduceOuterDim(self, src, dimension, unary_op, binary_op, init);
+    THCudaTensor_transformReduceOuterDim(self, src, dimension, unary_op, init, binary_op);
   }
 
   THCudaTensor_free(src);


template<class UnaryFunction, class BinaryFunction>
__host__ void THCudaTensor_transformReduceOuterDim(THCudaTensor *tgt, THCudaTensor *src,
        long rdim, UnaryFunction unary_op, BinaryFunction binary_op, float init)
{
  const size_t reduce = 3;
  dim4 src_stride(0);


template<class UnaryFunction, class BinaryFunction>
void THCudaTensor_transformReduceDim(THCudaTensor *self_, THCudaTensor *src,
        long dimension, UnaryFunction unary_op, float init, BinaryFunction binary_op)
{
  THArgCheck(dimension >= 0 && dimension < THCudaTensor_nDimension(src), 3, "dimension out of range");
  THArgCheck(THCudaTensor_nDimension(src) <= 4, 2, "too many dimensions (>4)");
