samskalicky commented on a change in pull request #17530: Add deferred compute support URL: https://github.com/apache/incubator-mxnet/pull/17530#discussion_r379848354
########## File path: src/ndarray/ndarray.cc ########## @@ -2088,6 +2117,25 @@ void NDArray::SyncCheckFormat(const bool full_check) const { CHECK_EQ(err, kNormalErr) << "Check the validity of this sparse NDArray"; } +void NDArray::WaitToRead() const { + if (is_none()) return; + Imperative::DCInfo::Compute(*this); + Engine::Get()->WaitForVar(ptr_->var); +} + +void NDArray::WaitToWrite() const { + if (is_none()) return; + Imperative::DCInfo::Compute(*this); + /*! + * Push an empty mutable function to flush all preceding reads to the + * variable. + */ Review comment: nit: does this need to be a multi-line comment? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services