コード例 #1
0
ファイル: trainer.py プロジェクト: AllanYiin/CNTK
    def __init__(self, model, criterion, parameter_learners, progress_writers=None):
        loss_function, eval_function = Trainer._get_loss_metric(criterion)
        # TODO sanitizing should be removed once Swig's typemaps are in place
        if model is not None:  # None means dummy model that is, e.g., the same as a criterion
            model = sanitize_function(model)
        loss_function = sanitize_function(loss_function)
        if eval_function is not None:
            eval_function = sanitize_function(eval_function)
        if not isinstance(parameter_learners, list):
            parameter_learners = [parameter_learners]
        if progress_writers is None:
            progress_writers = []
        elif not isinstance(progress_writers, list):
            progress_writers = [progress_writers]

        trainer = cntk_py.trainer_impl(model, loss_function, eval_function, parameter_learners, progress_writers)
        # transplant into this class instance
        self.__dict__ = trainer.__dict__
コード例 #2
0
ファイル: trainer.py プロジェクト: yaronyg/CNTK
    def __init__(self, model, criterion, parameter_learners, progress_writers=None):
        loss_function, eval_function = Trainer._get_loss_metric(criterion)
        # TODO sanitizing should be removed once Swig's typemaps are in place
        if model is not None:  # None means dummy model that is, e.g., the same as a criterion
            model = sanitize_function(model)
        loss_function = sanitize_function(loss_function)
        if eval_function is not None:
            eval_function = sanitize_function(eval_function)
        if not isinstance(parameter_learners, list):
            parameter_learners = [parameter_learners]
        if progress_writers is None:
            progress_writers = []
        elif not isinstance(progress_writers, list):
            progress_writers = [progress_writers]

        trainer = cntk_py.trainer_impl(model, loss_function, eval_function, parameter_learners, progress_writers)
        # transplant into this class instance
        self.__dict__ = trainer.__dict__
コード例 #3
0
    def __init__(self, eval_function, progress_writers=None):
        if eval_function is not None:
            eval_function = sanitize_function(eval_function)

        if progress_writers is None:
            progress_writers = []
        elif not isinstance(progress_writers, list):
            progress_writers = [progress_writers]

        evaluator = cntk_py.create_evaluator(eval_function, progress_writers)
        # transplant into this class instance
        self.__dict__ = evaluator.__dict__
コード例 #4
0
ファイル: evaluator.py プロジェクト: Tak-Au/CNTK
    def __init__(self, eval_function, progress_writers=None):
        if eval_function is not None:
            eval_function = sanitize_function(eval_function)

        if progress_writers is None:
            progress_writers = []
        elif not isinstance(progress_writers, list):
            progress_writers = [progress_writers]

        evaluator = cntk_py.create_evaluator(eval_function, progress_writers)
        # transplant into this class instance
        self.__dict__ = evaluator.__dict__