From 30faf44a08edcc2075362c4633f6b1d291944cd3 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Tue, 29 Mar 2016 12:27:35 +0200 Subject: This HPC stuff doesn't work very well. --- model/hpc_lstm.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'model/hpc_lstm.py') diff --git a/model/hpc_lstm.py b/model/hpc_lstm.py index 395646c..d3c33a2 100644 --- a/model/hpc_lstm.py +++ b/model/hpc_lstm.py @@ -10,7 +10,7 @@ from blocks.initialization import IsotropicGaussian, Constant from blocks.filter import VariableFilter from blocks.roles import WEIGHT -from blocks.graph import ComputationGraph, apply_noise, apply_dropout +from blocks.graph import ComputationGraph, apply_noise class Model(): @@ -103,10 +103,20 @@ class Model(): # Initialize all bricks for brick in bricks: - brick.weights_init = IsotropicGaussian(0.1) - brick.biases_init = Constant(0.) + brick.weights_init = config.weights_init + brick.biases_init = config.biases_init brick.initialize() + # apply noise + cg = ComputationGraph([sgd_cost, cost, error_rate]+costs) + if config.weight_noise > 0: + noise_vars = VariableFilter(roles=[WEIGHT])(cg) + cg = apply_noise(cg, noise_vars, config.weight_noise) + sgd_cost = cg.outputs[0] + cost = cg.outputs[1] + error_rate = cg.outputs[2] + costs = cg.outputs[3:] + # put stuff into self that is usefull for training or extensions self.sgd_cost = sgd_cost -- cgit v1.2.3