Commit b912c32a authored by Yuxin Wu's avatar Yuxin Wu

remove deprecated StatPrinter

parent 16145cc8
...@@ -8,7 +8,6 @@ import time ...@@ -8,7 +8,6 @@ import time
import traceback import traceback
from .base import Callback from .base import Callback
from .stats import StatPrinter
from .hooks import CallbackToHook from .hooks import CallbackToHook
from ..utils import logger from ..utils import logger
...@@ -57,18 +56,6 @@ class Callbacks(Callback): ...@@ -57,18 +56,6 @@ class Callbacks(Callback):
# check type # check type
for cb in cbs: for cb in cbs:
assert isinstance(cb, Callback), cb.__class__ assert isinstance(cb, Callback), cb.__class__
# move "StatPrinter" to the last
# TODO don't need to manually move in the future.
for idx, cb in enumerate(cbs):
if isinstance(cb, StatPrinter):
sp = cb
cbs.remove(sp)
cbs.append(sp)
if idx != len(cbs) - 1:
logger.warn("StatPrinter should appear as the last element of callbacks! "
"This is now fixed automatically, but may not work in the future.")
break
self.cbs = cbs self.cbs = cbs
def _setup_graph(self): def _setup_graph(self):
......
...@@ -6,16 +6,8 @@ import os ...@@ -6,16 +6,8 @@ import os
from .base import Callback from .base import Callback
from ..utils import logger from ..utils import logger
from ..utils.develop import log_deprecated
__all__ = ['StatPrinter', 'SendStat'] __all__ = ['SendStat']
class StatPrinter(Callback):
def __init__(self, print_tag=None):
log_deprecated("StatPrinter",
"No need to add StatPrinter to callbacks anymore!",
"2017-05-26")
class SendStat(Callback): class SendStat(Callback):
......
...@@ -78,13 +78,9 @@ class TrainConfig(object): ...@@ -78,13 +78,9 @@ class TrainConfig(object):
if callbacks is None: if callbacks is None:
callbacks = [] callbacks = []
if isinstance(callbacks, Callbacks): assert not isinstance(callbacks, Callbacks), \
# keep quiet now because I haven't determined the final API yet. "TrainConfig(callbacks=Callbacks([...]))" \
log_deprecated( "Change the argument 'callbacks=' to a *list* of callbacks without StatPrinter()."
"TrainConfig(callbacks=Callbacks([...]))",
"Change the argument 'callbacks=' to a *list* of callbacks without StatPrinter().")
callbacks = callbacks.cbs[:-1] # the last one is StatPrinter()
assert_type(callbacks, list) assert_type(callbacks, list)
if extra_callbacks is None: if extra_callbacks is None:
extra_callbacks = [ extra_callbacks = [
......
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