     ldb = batch2_->stride[1];
   }
 
+  long num_batches = result_->size[0];
+
+#if defined(THC_REAL_IS_FLOAT) || defined(THC_REAL_IS_DOUBLE)
   // Compute pointers to matrices in each batch.
-  long num_batches = result_->size[0];
   size_t matrices_size = num_batches * sizeof(real*);
 
   // Copy pointers to device.

  THCudaFree(state, d_matrices2);
  THCudaFree(state, d_result_matrices);

  if (batch1_ != batch1) {
    THCTensor_(free)(state, batch1_);
  }

THC_API void
THCTensor_(baddbmm)(THCState *state, THCTensor *result, real beta, THCTensor *t,
                    real alpha, THCTensor *batch1, THCTensor *batch2) {
#if defined(THC_REAL_IS_HALF) || defined(THC_REAL_IS_FLOAT) || defined(THC_REAL_IS_DOUBLE)
  THCAssertSameGPU(THCTensor_(checkGPU)(state, 4, result, t, batch1, batch2));
  THArgCheck(THCTensor_(nDimension)(state, t) == 3, 4, "expected 3D tensor");
  THArgCheck(THCTensor_(nDimension)(state, batch1) == 3, 6, "expected 3D tensor");
