本文整理汇总了Python中mlp.MLP.saveLastLayer方法的典型用法代码示例。如果您正苦于以下问题:Python MLP.saveLastLayer方法的具体用法?Python MLP.saveLastLayer怎么用?Python MLP.saveLastLayer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mlp.MLP
的用法示例。
在下文中一共展示了MLP.saveLastLayer方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: map
# 需要导入模块: from mlp import MLP [as 别名]
# 或者: from mlp.MLP import saveLastLayer [as 别名]
map(lambda x:x.dealloc(), rbmstack.layers)
weights = map(lambda x: x.mat, rbmstack.weights)
biases = map(lambda x: x.bias_hi, rbmstack.weights)
from mlp import MLP
pymlp = MLP(cfg, weights,biases)
pymlp.preEpochHook = lambda mlp,epoch: epoch%10==0 and mlp.runMLP(mbp_test, cfg.test_batchsize,epoch)
try:
pymlp.train(mbp,cfg.finetune_epochs, cfg.finetune_batch_size, cfg.finetune_rprop)
except KeyboardInterrupt:
pass
map(lambda x:x.alloc(), rbmstack.layers)
map(lambda x:x.allocPChain(), rbmstack.layers)
rbmstack.saveAllLayers("-finetune")
pymlp.saveLastLayer()
if cfg.headless:
cp.exitCUDA()
sys.exit(0)
PLT_NUM=1
import matplotlib.pyplot as plt
#### calculate maps_bottom into py. yeah it's a dirty hack, i know
px=cfg.px
py=cfg.py
if "projection_results" in rbmstack.__dict__:
for layernum in rbmstack.projection_results.keys():
filters = rbmstack.projection_results[layernum].T
print "Saving projections from layer %d (%d x %d)" % (layernum,filters.shape[0],filters.shape[1])