From 418c5c2f804195751b929fe14105014115e9bdec Mon Sep 17 00:00:00 2001 From: Yizhi Liu Date: Thu, 6 Feb 2020 15:55:53 -0800 Subject: [PATCH] [Scala/Java] Remove unnecessary data slicing --- .../org/apache/mxnet/module/DataParallelExecutorGroup.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scala-package/core/src/main/scala/org/apache/mxnet/module/DataParallelExecutorGroup.scala b/scala-package/core/src/main/scala/org/apache/mxnet/module/DataParallelExecutorGroup.scala index 74e63be3916b..4154e121c451 100644 --- a/scala-package/core/src/main/scala/org/apache/mxnet/module/DataParallelExecutorGroup.scala +++ b/scala-package/core/src/main/scala/org/apache/mxnet/module/DataParallelExecutorGroup.scala @@ -33,7 +33,7 @@ private object DataParallelExecutorGroup { majorAxis: Seq[Int]): Unit = { for (((dSrc, dTargets), axis) <- data zip targets zip majorAxis) { for (((sliceIdxStart, sliceIdxStop), dDst) <- dTargets) { - if (axis >= 0) { + if (axis >= 0 && (sliceIdxStart > 0 || sliceIdxStop < dSrc.shape(axis))) { // copy slice val shape = dSrc.shape val begin = Array.fill(shape.length)(0)