Commit c9226e90 authored by Yuxin Wu's avatar Yuxin Wu

print deprecate warning only once #377

parent 27957082
...@@ -9,6 +9,7 @@ from six.moves import zip ...@@ -9,6 +9,7 @@ from six.moves import zip
from .base import Callback from .base import Callback
from ..utils import logger from ..utils import logger
from ..utils.utils import execute_only_once
from ..utils.stats import RatioCounter, BinaryStatistics from ..utils.stats import RatioCounter, BinaryStatistics
from ..tfutils.common import get_op_tensor_name from ..tfutils.common import get_op_tensor_name
...@@ -57,7 +58,7 @@ class Inferencer(Callback): ...@@ -57,7 +58,7 @@ class Inferencer(Callback):
try: try:
ret = self._get_fetches() ret = self._get_fetches()
except NotImplementedError: except NotImplementedError:
logger.warn("Inferencer._get_output_tensors was renamed to _get_fetches") logger.warn("Inferencer._get_output_tensors was deprecated and renamed to _get_fetches")
ret = self._get_output_tensors() ret = self._get_output_tensors()
return [get_op_tensor_name(n)[1] for n in ret] return [get_op_tensor_name(n)[1] for n in ret]
...@@ -79,7 +80,8 @@ class Inferencer(Callback): ...@@ -79,7 +80,8 @@ class Inferencer(Callback):
try: try:
self._on_fetches(results) self._on_fetches(results)
except NotImplementedError: except NotImplementedError:
logger.warn("Inferencer._datapoint was renamed to _on_fetches") if execute_only_once():
logger.warn("Inferencer._datapoint was deprecated and renamed to _on_fetches.")
self._datapoint(results) self._datapoint(results)
def _datapoint(self, results): def _datapoint(self, results):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment