use of org.apache.sysml.lops.Ternary in project incubator-systemml by apache.
the class TernaryOp method constructLopsTernaryDefault.
private void constructLopsTernaryDefault() {
ExecType et = optFindExecType();
if (getInput().stream().allMatch(h -> h.getDataType().isScalar()))
// always CP for pure scalar operations
et = ExecType.CP;
Ternary plusmult = null;
if (et == ExecType.CP || et == ExecType.SPARK || et == ExecType.GPU) {
plusmult = new Ternary(HopsOpOp3Lops.get(_op), getInput().get(0).constructLops(), getInput().get(1).constructLops(), getInput().get(2).constructLops(), getDataType(), getValueType(), et);
} else {
// MR
Hop first = getInput().get(0);
Hop second = getInput().get(1);
Hop third = getInput().get(2);
Lop firstLop = first.constructLops();
if (first.getDataType().isMatrix()) {
firstLop = new Group(firstLop, Group.OperationTypes.Sort, getDataType(), getValueType());
setLineNumbers(firstLop);
setOutputDimensions(firstLop);
}
Lop secondLop = second.constructLops();
if (second.getDataType().isMatrix()) {
secondLop = new Group(secondLop, Group.OperationTypes.Sort, getDataType(), getValueType());
setLineNumbers(secondLop);
setOutputDimensions(secondLop);
}
Lop thirdLop = third.constructLops();
if (third.getDataType().isMatrix()) {
thirdLop = new Group(thirdLop, Group.OperationTypes.Sort, getDataType(), getValueType());
setLineNumbers(thirdLop);
setOutputDimensions(thirdLop);
}
plusmult = new Ternary(HopsOpOp3Lops.get(_op), firstLop, secondLop, thirdLop, getDataType(), getValueType(), et);
}
setOutputDimensions(plusmult);
setLineNumbers(plusmult);
setLops(plusmult);
}
use of org.apache.sysml.lops.Ternary in project systemml by apache.
the class TernaryOp method constructLopsTernaryDefault.
private void constructLopsTernaryDefault() {
ExecType et = optFindExecType();
if (getInput().stream().allMatch(h -> h.getDataType().isScalar()))
// always CP for pure scalar operations
et = ExecType.CP;
Ternary plusmult = null;
if (et == ExecType.CP || et == ExecType.SPARK || et == ExecType.GPU) {
plusmult = new Ternary(HopsOpOp3Lops.get(_op), getInput().get(0).constructLops(), getInput().get(1).constructLops(), getInput().get(2).constructLops(), getDataType(), getValueType(), et);
} else {
// MR
Hop first = getInput().get(0);
Hop second = getInput().get(1);
Hop third = getInput().get(2);
Lop firstLop = first.constructLops();
if (first.getDataType().isMatrix()) {
firstLop = new Group(firstLop, Group.OperationTypes.Sort, getDataType(), getValueType());
setLineNumbers(firstLop);
setOutputDimensions(firstLop);
}
Lop secondLop = second.constructLops();
if (second.getDataType().isMatrix()) {
secondLop = new Group(secondLop, Group.OperationTypes.Sort, getDataType(), getValueType());
setLineNumbers(secondLop);
setOutputDimensions(secondLop);
}
Lop thirdLop = third.constructLops();
if (third.getDataType().isMatrix()) {
thirdLop = new Group(thirdLop, Group.OperationTypes.Sort, getDataType(), getValueType());
setLineNumbers(thirdLop);
setOutputDimensions(thirdLop);
}
plusmult = new Ternary(HopsOpOp3Lops.get(_op), firstLop, secondLop, thirdLop, getDataType(), getValueType(), et);
}
setOutputDimensions(plusmult);
setLineNumbers(plusmult);
setLops(plusmult);
}
Aggregations