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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations