use of com.tencent.angel.model.output.format.MatrixFilesMeta in project angel by Tencent.
the class ModelLoader method loadToFloatArrays.
/**
* Load dense float model to a 2-dimension float array
*
* @param modelDir model save directory path
* @return model data
*/
public static float[][] loadToFloatArrays(String modelDir, Configuration conf) throws IOException {
// Load model meta
MatrixFilesMeta meta = getMeta(modelDir, conf);
RowType rowType = RowType.valueOf(meta.getRowType());
// Check row type
if (rowType != RowType.T_FLOAT_DENSE && rowType != RowType.T_FLOAT_DENSE_COMPONENT) {
throw new IOException("model row type is not dense float, you should check it");
}
// Load model
DenseFloatModel model = new DenseFloatModel(meta.getRow(), meta.getCol());
loadModel(modelDir, model, meta, conf);
return model.getModel();
}
Aggregations