本文整理汇总了Python中cntk.Trainer._get_loss_metric方法的典型用法代码示例。如果您正苦于以下问题:Python Trainer._get_loss_metric方法的具体用法?Python Trainer._get_loss_metric怎么用?Python Trainer._get_loss_metric使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cntk.Trainer
的用法示例。
在下文中一共展示了Trainer._get_loss_metric方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Evaluator
# 需要导入模块: from cntk import Trainer [as 别名]
# 或者: from cntk.Trainer import _get_loss_metric [as 别名]
def Evaluator(criterion):
loss, metric = Trainer._get_loss_metric(criterion)
parameters = set(loss.parameters)
if metric:
parameters |= set(metric.parameters)
dummy_learner = momentum_sgd(tuple(parameters),
lr = learning_rate_schedule(1, UnitType.minibatch),
momentum = momentum_as_time_constant_schedule(0))
return Trainer(None, (loss, metric), dummy_learner)
示例2: Evaluator
# 需要导入模块: from cntk import Trainer [as 别名]
# 或者: from cntk.Trainer import _get_loss_metric [as 别名]
def Evaluator(model, criterion):
from cntk import Trainer
from cntk.learners import momentum_sgd, learning_rate_schedule, UnitType, momentum_as_time_constant_schedule
loss, metric = Trainer._get_loss_metric(criterion)
parameters = set(loss.parameters)
if model:
parameters |= set(model.parameters)
if metric:
parameters |= set(metric.parameters)
dummy_learner = momentum_sgd(tuple(parameters),
lr = learning_rate_schedule(1, UnitType.minibatch),
momentum = momentum_as_time_constant_schedule(0))
return Trainer(model, (loss, metric), dummy_learner)
示例3: Evaluator
# 需要导入模块: from cntk import Trainer [as 别名]
# 或者: from cntk.Trainer import _get_loss_metric [as 别名]
def Evaluator(model, criterion):
from cntk import Trainer
from cntk.learners import momentum_sgd, momentum_schedule_per_sample
loss, metric = Trainer._get_loss_metric(criterion)
parameters = set(loss.parameters)
if model:
parameters |= set(model.parameters)
if metric:
parameters |= set(metric.parameters)
dummy_learner = momentum_sgd(tuple(parameters),
lr = learning_parameter_schedule(1),
momentum = momentum_schedule_per_sample(0))
return Trainer(model, (loss, metric), dummy_learner)