This is an automated email from the ASF dual-hosted git repository.

markd pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/systemds.git

commit 007b684a99090b178ec33d3c75f38f7ccaccf07a
Author: Mark Dokter <[email protected]>
AuthorDate: Sun Aug 15 13:17:20 2021 +0200

    [MINOR] Bugfix batchnorm2d CUDA instruction (null pointer exception)
---
 .../sysds/runtime/instructions/gpu/context/GPUObject.java      | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git 
a/src/main/java/org/apache/sysds/runtime/instructions/gpu/context/GPUObject.java
 
b/src/main/java/org/apache/sysds/runtime/instructions/gpu/context/GPUObject.java
index 1c1cb2b..efbf201 100644
--- 
a/src/main/java/org/apache/sysds/runtime/instructions/gpu/context/GPUObject.java
+++ 
b/src/main/java/org/apache/sysds/runtime/instructions/gpu/context/GPUObject.java
@@ -845,7 +845,8 @@ public class GPUObject {
                                copyToDevice = false;
                        } else if (block == null && tmp.getNonZeros() != 0) {
                                throw new DMLRuntimeException("Expected CP 
sparse block to be not null.");
-                       } else {
+                       }
+                       else {
                                // CSR is the preferred format for cuSparse GEMM
                                // Converts MCSR and COO to CSR
                                SparseBlockCSR csrBlock = null;
@@ -880,8 +881,11 @@ public class GPUObject {
                                values = csrBlock.values();
                        }
 
-                       if (values.length > tmp.getNonZeros())
-                               allocateSparseMatrixOnDevice(values.length);
+                       if (values != null)
+                               if(values.length > tmp.getNonZeros())
+                                       
allocateSparseMatrixOnDevice(values.length);
+                               else
+                                       allocateSparseMatrixOnDevice();
                        else
                                allocateSparseMatrixOnDevice();
 

Reply via email to