Repository: incubator-systemml Updated Branches: refs/heads/master 0a165c468 -> 13e1bd930
[SYSTEMML-540] Avoid unnecessary sel+ operation in case of fused_maxpooling Project: http://git-wip-us.apache.org/repos/asf/incubator-systemml/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-systemml/commit/13e1bd93 Tree: http://git-wip-us.apache.org/repos/asf/incubator-systemml/tree/13e1bd93 Diff: http://git-wip-us.apache.org/repos/asf/incubator-systemml/diff/13e1bd93 Branch: refs/heads/master Commit: 13e1bd9301be1083caa8039adf43af4a8bf326c6 Parents: 0a165c4 Author: Niketan Pansare <[email protected]> Authored: Sun Jan 8 13:29:58 2017 -0800 Committer: Niketan Pansare <[email protected]> Committed: Sun Jan 8 13:29:58 2017 -0800 ---------------------------------------------------------------------- src/main/java/org/apache/sysml/hops/UnaryOp.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/13e1bd93/src/main/java/org/apache/sysml/hops/UnaryOp.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/hops/UnaryOp.java b/src/main/java/org/apache/sysml/hops/UnaryOp.java index 0ab4bad..85c396f 100644 --- a/src/main/java/org/apache/sysml/hops/UnaryOp.java +++ b/src/main/java/org/apache/sysml/hops/UnaryOp.java @@ -140,7 +140,15 @@ public class UnaryOp extends Hop implements MultiThreadedHop if( optype == null ) throw new HopsException("Unknown UnaryCP lop type for UnaryOp operation type '"+_op+"'"); - UnaryCP unary1 = new UnaryCP(input.constructLops(), optype, getDataType(), getValueType()); + UnaryCP unary1 = null; + if((_op == Hop.OpOp1.NROW || _op == Hop.OpOp1.NCOL || _op == Hop.OpOp1.LENGTH) && + input instanceof UnaryOp && ((UnaryOp) input).getOp() == OpOp1.SELP) { + // Dimensions does not change during sel+ operation. + // This case is helpful to avoid unnecessary sel+ operation for fused maxpooling. + unary1 = new UnaryCP(input.getInput().get(0).constructLops(), optype, getDataType(), getValueType()); + } + else + unary1 = new UnaryCP(input.constructLops(), optype, getDataType(), getValueType()); setOutputDimensions(unary1); setLineNumbers(unary1);
