mxnet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] cjolivier01 commented on a change in pull request #8342: [WIP] 2bit gradient compression
Date Thu, 01 Jan 1970 00:00:00 GMT
cjolivier01 commented on a change in pull request #8342: [WIP] 2bit gradient compression
URL: https://github.com/apache/incubator-mxnet/pull/8342#discussion_r145831333
 
 

 ##########
 File path: src/ndarray/ndarray.cc
 ##########
 @@ -558,6 +558,101 @@ void CopyFromTo(const NDArray& from, const NDArray& to, int
priority) {
   }
 }
 
+void Quantize(const NDArray &from, NDArray *to, NDArray *residual, const std::string&
compress,
+              const float neg_threshold, const float pos_threshold,
+              int priority) {
+  CHECK(from.shape().ndim() != 0)
+      << "source operands have zero dimension shape";
+  // important: callback must always capture by value
+  NDArray ret = *to;
+  NDArray res = *residual;
+  int a = from.ctx().dev_mask();
+  int b = to->ctx().dev_mask();
+  if (a == cpu::kDevMask && b == cpu::kDevMask) {
+    if (compress == "2bit") {
+      Engine::Get()->PushSync([from, res, ret, neg_threshold, pos_threshold](RunContext
ctx) {
 
 Review comment:
   res and ret passing by value is expensive. Please pass as reference or pass the pointers

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message