Skip to content

Commit

Permalink
fix the parsing issue (deepjavalibrary#1857)
Browse files Browse the repository at this point in the history
  • Loading branch information
lanking520 authored and patins1 committed Aug 26, 2022
1 parent a7ff335 commit ddd126b
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import ai.djl.ndarray.NDManager;
import ai.djl.ndarray.types.DataType;
import ai.djl.paddlepaddle.jni.JniUtils;
import ai.djl.translate.ArgumentsUtil;
import ai.djl.translate.Translator;

import java.io.FileNotFoundException;
Expand Down Expand Up @@ -86,10 +87,12 @@ public void load(Path modelPath, String prefix, Map<String, ?> options) throws I
JniUtils.disableGLog(config);
}
if (options.containsKey("CMLNumThreads")) {
JniUtils.cpuMathLibraryNumThreads(config, (Integer) options.get("CMLNumThreads"));
JniUtils.cpuMathLibraryNumThreads(
config, ArgumentsUtil.intValue(options, "CMLNumThreads"));
}
if (options.containsKey("SwitchIrOptim")) {
JniUtils.switchIrOptim(config, (Boolean) options.get("SwitchIrOptim"));
JniUtils.switchIrOptim(
config, ArgumentsUtil.booleanValue(options, "SwitchIrOptim"));
}
}
paddlePredictor = new PaddlePredictor(JniUtils.createPredictor(config));
Expand Down

0 comments on commit ddd126b

Please sign in to comment.