return h1_t, h2_t, h3_t ((h1_temp, h2_temp, h3_temp), updates) = theano.scan(fn=inner_fn, sequences=[x], outputs_info=[s1_0, s2_0, s3_0]) ts, _, _ = y.shape post_scan_shape = ((ts*batch_size, -1)) h1_in = h1_temp.reshape(post_scan_shape) h2_in = h2_temp.reshape(post_scan_shape) h3_in = h3_temp.reshape(post_scan_shape) y_hat_in = output.fprop([h1_in, h2_in, h3_in]) cost = NllMulInd(y.flatten(), y_hat_in) cost = cost.mean() cost.name = 'cost' model.inputs = [x, y] model._params = params model.nodes = nodes model.set_updates(update_list) optimizer = Adam( lr=0.001 ) extension = [ GradientClipping(batch_size=batch_size), EpochCount(100), Monitoring(freq=100,
((h1_temp, h2_temp, h3_temp), updates) = theano.scan(fn=inner_fn, sequences=[x], outputs_info=[s1_0, s2_0, s3_0]) ts, _, _ = y.shape post_scan_shape = ((ts * batch_size, -1)) h1_in = h1_temp.reshape(post_scan_shape) h2_in = h2_temp.reshape(post_scan_shape) h3_in = h3_temp.reshape(post_scan_shape) y_hat_in = output.fprop([h1_in, h2_in, h3_in]) cost = NllMulInd(y.flatten(), y_hat_in) cost = cost.mean() cost.name = 'cost' model.inputs = [x, y] model._params = params model.nodes = nodes model.set_updates(update_list) optimizer = Adam(lr=0.001) extension = [ GradientClipping(batch_size=batch_size), EpochCount(100), Monitoring(freq=100, ddout=[cost]), Picklize(freq=100, path=save_path) ]