From e59e125714804124de8a9a38c9f056835ecba6c4 Mon Sep 17 00:00:00 2001 From: reminisce Date: Fri, 21 Jul 2017 13:38:05 -0700 Subject: [PATCH] More comments --- src/ndarray/ndarray.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/ndarray/ndarray.cc b/src/ndarray/ndarray.cc index 48875408e38a..4a402def143d 100644 --- a/src/ndarray/ndarray.cc +++ b/src/ndarray/ndarray.cc @@ -1131,6 +1131,12 @@ void NDArray::SyncCopyFromNDArray(const NDArray& src, int i, int j) { } // The copy operation was pushed to engine to execute. // Need to wait here for it being completed. + // The reason for pushing the copy operation to engine + // is because when copying data from a sparse tensor + // to the current one, that sparse ndarray's storage_shape/aux_shape + // may not be ready or changed and we need to ensure + // thread safty for reading the correct shape info to allocate + // memory for the current ndarray. WaitToRead(); }