|
@@ -41,8 +41,7 @@ class BasePaddlePredictor(BaseComponent):
|
|
|
if self.option and option == self.option:
|
|
if self.option and option == self.option:
|
|
|
return
|
|
return
|
|
|
self._option = option
|
|
self._option = option
|
|
|
- self._option.attach(self)
|
|
|
|
|
- self.reset()
|
|
|
|
|
|
|
+ self._reset()
|
|
|
|
|
|
|
|
@property
|
|
@property
|
|
|
def option(self):
|
|
def option(self):
|
|
@@ -52,9 +51,10 @@ class BasePaddlePredictor(BaseComponent):
|
|
|
def option(self, option):
|
|
def option(self, option):
|
|
|
self._update_option(option)
|
|
self._update_option(option)
|
|
|
|
|
|
|
|
- def reset(self):
|
|
|
|
|
|
|
+ def _reset(self):
|
|
|
if not self.option:
|
|
if not self.option:
|
|
|
self.option = PaddlePredictorOption()
|
|
self.option = PaddlePredictorOption()
|
|
|
|
|
+ logging.debug(f"Env: {self.option}")
|
|
|
(
|
|
(
|
|
|
self.predictor,
|
|
self.predictor,
|
|
|
self.inference_config,
|
|
self.inference_config,
|
|
@@ -62,7 +62,7 @@ class BasePaddlePredictor(BaseComponent):
|
|
|
self.input_handlers,
|
|
self.input_handlers,
|
|
|
self.output_handlers,
|
|
self.output_handlers,
|
|
|
) = self._create()
|
|
) = self._create()
|
|
|
- logging.debug(f"Env: {self.option}")
|
|
|
|
|
|
|
+ self.option.changed = False
|
|
|
|
|
|
|
|
def _create(self):
|
|
def _create(self):
|
|
|
"""_create"""
|
|
"""_create"""
|
|
@@ -168,6 +168,8 @@ No need to generate again."
|
|
|
return self.input_names
|
|
return self.input_names
|
|
|
|
|
|
|
|
def apply(self, **kwargs):
|
|
def apply(self, **kwargs):
|
|
|
|
|
+ if self.option.changed:
|
|
|
|
|
+ self._reset()
|
|
|
x = self.to_batch(**kwargs)
|
|
x = self.to_batch(**kwargs)
|
|
|
for idx in range(len(x)):
|
|
for idx in range(len(x)):
|
|
|
self.input_handlers[idx].reshape(x[idx].shape)
|
|
self.input_handlers[idx].reshape(x[idx].shape)
|