roywei commented on a change in pull request #14629: [MXNET-1333] Estimator and Fit API URL: https://github.com/apache/incubator-mxnet/pull/14629#discussion_r272750129
########## File path: python/mxnet/gluon/contrib/estimator/event_handler.py ########## @@ -0,0 +1,346 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# coding: utf-8 +# pylint: disable=wildcard-import +"""Gluon EventHandlers for Estimators""" + +__all__ = ['EventHandler', 'LoggingHandler'] +import logging +import os +import time +import warnings + +import numpy as np + + +class EventHandler(object): Review comment: i added a [method to check if a handlers has implemented](https://github.com/apache/incubator-mxnet/pull/14629/files#diff-7f58d4d4cb6c2e6088afa89097fbb7e3R335) `train_begin` ect to avoid unnecessary `pass` calls. The time it takes should be the same as using multi-inheritence and do a bunch of `isinstance()` at the beginning. The benefit is user can override any event call without inherit multiple class. Still looking into how to use forward hook to register different input args Thanks! ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
