Commit b912c32a authored by Yuxin Wu's avatar Yuxin Wu

remove deprecated StatPrinter

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