From d9f1b0b16edeb59281355a855e18a8be343fc33c Mon Sep 17 00:00:00 2001
From: Joseph Redmon <pjreddie@gmail.com>
Date: Fri, 08 Aug 2014 19:04:15 +0000
Subject: [PATCH] probably how maxpool layers should be

---
 src/gemm.cl |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gemm.cl b/src/gemm.cl
index 91375a7..9e45783 100644
--- a/src/gemm.cl
+++ b/src/gemm.cl
@@ -27,8 +27,8 @@
         int brow = i + sub_row;
         int bcol = col_block*BLOCK + sub_col;
 
-        Asub[sub_row][sub_col] = TA ? A[arow + acol*lda] : A[arow*lda + acol];
-        Bsub[sub_row][sub_col] = TB ? B[brow + bcol*ldb] : B[brow*ldb + bcol];
+        if(arow < M && acol < K)Asub[sub_row][sub_col] = TA ? A[arow + acol*lda] : A[arow*lda + acol];
+        if(brow < K && bcol < N)Bsub[sub_row][sub_col] = TB ? B[brow + bcol*ldb] : B[brow*ldb + bcol];
 
         barrier(CLK_LOCAL_MEM_FENCE);
 

--
Gitblit v1.10.0