Search in sources :

Example 1 with PartitionMetaProto

use of com.tencent.angel.protobuf.generated.MLProtos.PartitionMetaProto in project angel by Tencent.

the class ProtobufUtil method convertToMatrixMeta.

public static MatrixMeta convertToMatrixMeta(MatrixMetaProto matrixMetaProto) throws ClassNotFoundException {
    MatrixContext matrixContext = convertToMatrixContext(matrixMetaProto.getMatrixContext());
    List<PartitionMetaProto> partMetaProtos = matrixMetaProto.getPartMetasList();
    int size = partMetaProtos.size();
    Map<Integer, PartitionMeta> partitionMetas = new HashMap<>(size);
    for (int i = 0; i < size; i++) {
        partitionMetas.put(partMetaProtos.get(i).getPartitionId(), convertToParitionMeta(matrixContext.getMatrixId(), partMetaProtos.get(i)));
    }
    return new MatrixMeta(matrixMetaProto.getTotalPartNum(), matrixContext, partitionMetas);
}
Also used : MatrixContext(com.tencent.angel.ml.matrix.MatrixContext) Int2IntOpenHashMap(it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) MatrixMeta(com.tencent.angel.ml.matrix.MatrixMeta) PartitionMeta(com.tencent.angel.ml.matrix.PartitionMeta) PartitionMetaProto(com.tencent.angel.protobuf.generated.MLProtos.PartitionMetaProto)

Aggregations

MatrixContext (com.tencent.angel.ml.matrix.MatrixContext)1 MatrixMeta (com.tencent.angel.ml.matrix.MatrixMeta)1 PartitionMeta (com.tencent.angel.ml.matrix.PartitionMeta)1 PartitionMetaProto (com.tencent.angel.protobuf.generated.MLProtos.PartitionMetaProto)1 Int2IntOpenHashMap (it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap)1 HashMap (java.util.HashMap)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1