Search in sources :

Example 1 with RowOffset

use of com.tencent.angel.model.output.format.ModelPartitionMeta.RowOffset in project angel by Tencent.

the class ModelLoader method loadDenseIntRowFromPartition.

public static int[] loadDenseIntRowFromPartition(FSDataInputStream input, ModelPartitionMeta partMeta, int rowId) throws IOException {
    RowOffset rowOffset = partMeta.getRowMetas().get(rowId);
    input.seek(rowOffset.getOffset());
    Preconditions.checkState(input.readInt() == rowId);
    int num = (int) (partMeta.getEndCol() - partMeta.getStartCol());
    int[] row = new int[num];
    for (int i = 0; i < num; i++) {
        row[i] = input.readInt();
    }
    return row;
}
Also used : RowOffset(com.tencent.angel.model.output.format.ModelPartitionMeta.RowOffset)

Example 2 with RowOffset

use of com.tencent.angel.model.output.format.ModelPartitionMeta.RowOffset in project angel by Tencent.

the class ModelLoader method loadSparseDoubleLongKeyRowFromPartition.

public static Long2DoubleOpenHashMap loadSparseDoubleLongKeyRowFromPartition(FSDataInputStream input, ModelPartitionMeta partMeta, int rowId) throws IOException {
    RowOffset rowOffset = partMeta.getRowMetas().get(rowId);
    input.seek(rowOffset.getOffset());
    Preconditions.checkState(input.readInt() == rowId);
    int num = input.readInt();
    Long2DoubleOpenHashMap row = new Long2DoubleOpenHashMap();
    for (int j = 0; j < num; j++) {
        row.put(input.readLong(), input.readDouble());
    }
    return row;
}
Also used : RowOffset(com.tencent.angel.model.output.format.ModelPartitionMeta.RowOffset) Long2DoubleOpenHashMap(it.unimi.dsi.fastutil.longs.Long2DoubleOpenHashMap)

Example 3 with RowOffset

use of com.tencent.angel.model.output.format.ModelPartitionMeta.RowOffset in project angel by Tencent.

the class ModelLoader method loadDenseDoubleRowFromPartition.

public static double[] loadDenseDoubleRowFromPartition(FSDataInputStream input, ModelPartitionMeta partMeta, int rowId) throws IOException {
    RowOffset rowOffset = partMeta.getRowMetas().get(rowId);
    input.seek(rowOffset.getOffset());
    Preconditions.checkState(input.readInt() == rowId);
    int num = (int) (partMeta.getEndCol() - partMeta.getStartCol());
    double[] row = new double[num];
    for (int i = 0; i < num; i++) {
        row[i] = input.readDouble();
    }
    return row;
}
Also used : RowOffset(com.tencent.angel.model.output.format.ModelPartitionMeta.RowOffset)

Example 4 with RowOffset

use of com.tencent.angel.model.output.format.ModelPartitionMeta.RowOffset in project angel by Tencent.

the class ModelLoader method loadSparseIntRowFromPartition.

public static Int2IntOpenHashMap loadSparseIntRowFromPartition(FSDataInputStream input, ModelPartitionMeta partMeta, int rowId) throws IOException {
    RowOffset rowOffset = partMeta.getRowMetas().get(rowId);
    input.seek(rowOffset.getOffset());
    Preconditions.checkState(input.readInt() == rowId);
    int num = input.readInt();
    Int2IntOpenHashMap row = new Int2IntOpenHashMap();
    for (int i = 0; i < num; i++) {
        row.put(input.readInt(), input.readInt());
    }
    return row;
}
Also used : RowOffset(com.tencent.angel.model.output.format.ModelPartitionMeta.RowOffset) Int2IntOpenHashMap(it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap)

Example 5 with RowOffset

use of com.tencent.angel.model.output.format.ModelPartitionMeta.RowOffset in project angel by Tencent.

the class ModelLoader method loadSparseDoubleRowFromPartition.

public static Int2DoubleOpenHashMap loadSparseDoubleRowFromPartition(FSDataInputStream input, ModelPartitionMeta partMeta, int rowId) throws IOException {
    RowOffset rowOffset = partMeta.getRowMetas().get(rowId);
    input.seek(rowOffset.getOffset());
    Preconditions.checkState(input.readInt() == rowId);
    int num = input.readInt();
    Int2DoubleOpenHashMap row = new Int2DoubleOpenHashMap();
    for (int i = 0; i < num; i++) {
        row.put(input.readInt(), input.readDouble());
    }
    return row;
}
Also used : RowOffset(com.tencent.angel.model.output.format.ModelPartitionMeta.RowOffset) Int2DoubleOpenHashMap(it.unimi.dsi.fastutil.ints.Int2DoubleOpenHashMap)

Aggregations

RowOffset (com.tencent.angel.model.output.format.ModelPartitionMeta.RowOffset)8 Int2DoubleOpenHashMap (it.unimi.dsi.fastutil.ints.Int2DoubleOpenHashMap)1 Int2FloatOpenHashMap (it.unimi.dsi.fastutil.ints.Int2FloatOpenHashMap)1 Int2IntOpenHashMap (it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap)1 Long2DoubleOpenHashMap (it.unimi.dsi.fastutil.longs.Long2DoubleOpenHashMap)1 Map (java.util.Map)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 FSDataOutputStream (org.apache.hadoop.fs.FSDataOutputStream)1