Search in sources :

Example 81 with LiteralOp

use of org.apache.sysml.hops.LiteralOp in project incubator-systemml by apache.

the class HopRewriteUtils method createDataGenOp.

public static Hop createDataGenOp(Hop rowInput, Hop colInput, double value) throws HopsException {
    Hop rows = (rowInput.getDim1() > 0) ? new LiteralOp(rowInput.getDim1()) : new UnaryOp("tmprows", DataType.SCALAR, ValueType.INT, OpOp1.NROW, rowInput);
    Hop cols = (colInput.getDim2() > 0) ? new LiteralOp(colInput.getDim2()) : new UnaryOp("tmpcols", DataType.SCALAR, ValueType.INT, OpOp1.NCOL, colInput);
    Hop val = new LiteralOp(value);
    HashMap<String, Hop> params = new HashMap<String, Hop>();
    params.put(DataExpression.RAND_ROWS, rows);
    params.put(DataExpression.RAND_COLS, cols);
    params.put(DataExpression.RAND_MIN, val);
    params.put(DataExpression.RAND_MAX, val);
    params.put(DataExpression.RAND_PDF, new LiteralOp(DataExpression.RAND_PDF_UNIFORM));
    params.put(DataExpression.RAND_LAMBDA, new LiteralOp(-1.0));
    params.put(DataExpression.RAND_SPARSITY, new LiteralOp(1.0));
    params.put(DataExpression.RAND_SEED, new LiteralOp(DataGenOp.UNSPECIFIED_SEED));
    //note internal refresh size information
    Hop datagen = new DataGenOp(DataGenMethod.RAND, new DataIdentifier("tmp"), params);
    datagen.setOutputBlocksizes(rowInput.getRowsInBlock(), colInput.getColsInBlock());
    copyLineNumbers(rowInput, datagen);
    if (value == 0)
        datagen.setNnz(0);
    return datagen;
}
Also used : AggUnaryOp(org.apache.sysml.hops.AggUnaryOp) UnaryOp(org.apache.sysml.hops.UnaryOp) DataIdentifier(org.apache.sysml.parser.DataIdentifier) HashMap(java.util.HashMap) DataGenOp(org.apache.sysml.hops.DataGenOp) Hop(org.apache.sysml.hops.Hop) LiteralOp(org.apache.sysml.hops.LiteralOp)

Aggregations

LiteralOp (org.apache.sysml.hops.LiteralOp)81 Hop (org.apache.sysml.hops.Hop)72 AggUnaryOp (org.apache.sysml.hops.AggUnaryOp)29 BinaryOp (org.apache.sysml.hops.BinaryOp)24 AggBinaryOp (org.apache.sysml.hops.AggBinaryOp)23 UnaryOp (org.apache.sysml.hops.UnaryOp)23 DataOp (org.apache.sysml.hops.DataOp)18 IndexingOp (org.apache.sysml.hops.IndexingOp)15 DataGenOp (org.apache.sysml.hops.DataGenOp)12 LeftIndexingOp (org.apache.sysml.hops.LeftIndexingOp)11 HashMap (java.util.HashMap)9 ArrayList (java.util.ArrayList)8 ReorgOp (org.apache.sysml.hops.ReorgOp)8 MatrixObject (org.apache.sysml.runtime.controlprogram.caching.MatrixObject)8 HopsException (org.apache.sysml.hops.HopsException)6 ParameterizedBuiltinOp (org.apache.sysml.hops.ParameterizedBuiltinOp)6 TernaryOp (org.apache.sysml.hops.TernaryOp)6 DataIdentifier (org.apache.sysml.parser.DataIdentifier)6 DMLRuntimeException (org.apache.sysml.runtime.DMLRuntimeException)6 QuaternaryOp (org.apache.sysml.hops.QuaternaryOp)5