Skip to content

Commit 87c743f

Browse files
authored
Merge pull request #222 from Atry/parallel-execution
Execute forward pass in parallel
2 parents 3ec753b + e099f52 commit 87c743f

File tree

1 file changed

+10
-3
lines changed
  • plugins-INDArrayLayers/src/main/scala-2.11/com/thoughtworks/deeplearning/plugins

1 file changed

+10
-3
lines changed

plugins-INDArrayLayers/src/main/scala-2.11/com/thoughtworks/deeplearning/plugins/INDArrayLayers.scala

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -732,8 +732,15 @@ trait INDArrayLayers extends DoubleLayers with DoubleLiterals with ImplicitsSing
732732
deepLearning1: DeepLearning.Aux[Operand1, Input1Data, Input1Delta],
733733
layerImplicits: ImplicitApply.Aux[indArrayPartialApplyRawForward.Rest, Out]
734734
): Out = {
735-
INDArrayLayer(Do.execute(()).intransitiveFlatMap { _ =>
736-
parallelApply2(deepLearning0.forward(operand0), deepLearning1.forward(operand1)) {
735+
INDArrayLayer(
736+
parallelApply2(
737+
Do.execute(()).intransitiveFlatMap { _ =>
738+
deepLearning0.forward(operand0)
739+
},
740+
Do.execute(()).intransitiveFlatMap { _ =>
741+
deepLearning1.forward(operand1)
742+
}
743+
) {
737744
case (Tape(data0, backward0), Tape(data1, backward1)) =>
738745
val (outputData, delta0, delta1) = f(data0, data1)
739746
val outputShape = outputData.shape
@@ -750,7 +757,7 @@ trait INDArrayLayers extends DoubleLayers with DoubleLiterals with ImplicitsSing
750757
}
751758
Tape(outputData, backward)
752759
}
753-
})
760+
)
754761
}
755762

756763
}

0 commit comments

Comments
 (0)