Skip to content

Commit

Permalink
[api] Allows subclass access member variable of Predictor (#2582)
Browse files Browse the repository at this point in the history
  • Loading branch information
frankfliu authored May 5, 2023
1 parent 636f271 commit 10d69fc
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions api/src/main/java/ai/djl/inference/Predictor.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,12 @@
public class Predictor<I, O> implements AutoCloseable {

private static final Logger logger = LoggerFactory.getLogger(Predictor.class);
private Translator<I, O> translator;
private long timestamp;

private boolean prepared;
private Model model;
protected Translator<I, O> translator;
protected long timestamp;

protected boolean prepared;
protected Model model;
protected NDManager manager;
protected Metrics metrics;
protected Block block;
Expand Down Expand Up @@ -357,12 +358,12 @@ protected void finalize() throws Throwable {
super.finalize();
}

private class PredictorContext implements TranslatorContext {
protected class PredictorContext implements TranslatorContext {

private NDManager ctxManager;
private Map<String, Object> attachments;

PredictorContext() {
protected PredictorContext() {
ctxManager = manager.newSubManager();
ctxManager.setName("predictor ctx");
attachments = new ConcurrentHashMap<>();
Expand Down

0 comments on commit 10d69fc

Please sign in to comment.