Skip to content

Commit

Permalink
Merge pull request #12 from david-ryan-snyder/xvector
Browse files Browse the repository at this point in the history
xvector: Fixes to make_jesus_configs.py
  • Loading branch information
danpovey committed Feb 21, 2016
2 parents a00652f + 5cdf82e commit c3c99b0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions egs/wsj/s5/steps/nnet3/xvector/make_jesus_configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ def __init__(self, config_string, input_dim, num_jesus_blocks, input_name):
def OutputDim(self):
return self.input_dim * (2 if self.output_stddev else 1) + (self.num_jesus_blocks if self.output_count else 0)


# OutputDims() returns an array of output dimensions... this node produces
# one output node, but this array explains how it's split up into different types
# of output (which will affect how we reorder the indexes for the jesus-layer).
Expand Down Expand Up @@ -168,10 +167,11 @@ def WriteConfigs(self, f):
self.input_name, self.left_context, self.right_context), file=f)
stats_dim = 1 + self.input_dim * (2 if self.output_stddev else 1)
print('component name={0}-pooling-{1}-{2} type=StatisticsPoolingComponent input-dim={3} '
'input-period={4} left-context={1} right-context={2} num-log-count-features=0 '
'input-period={4} left-context={1} right-context={2} num-log-count-features={6} '
'output-stddevs={5} '.format(self.input_name, self.left_context, self.right_context,
stats_dim, self.stats_period,
('true' if self.output_stddev else 'false')),
('true' if self.output_stddev else 'false'),
(self.num_jesus_blocks if self.output_count else 0)),
file=f)
print('component-node name={0}-pooling-{1}-{2} component={0}-pooling-{1}-{2} input={0}-extraction-{1}-{2} '.format(
self.input_name, self.left_context, self.right_context), file=f)
Expand Down Expand Up @@ -369,7 +369,6 @@ def WriteConfigs(self, f):

cur_output = 'x-jesus{0}-output-affine'.format(l)


print('component name=x-final-relu type=RectifiedLinearComponent dim={0} self-repair-scale={1}'.format(
cur_affine_output_dim, args.self_repair_scale), file=f)
print('component-node name=x-final-relu component=x-final-relu input={0}'.format(cur_output),
Expand All @@ -394,10 +393,11 @@ def WriteConfigs(self, f):
# nodes.

# First the S output...
s_dim = ((args.output_dim)*(args.output_dim+1)) / 2
s_dim = ((args.output_dim)*(args.output_dim+1))/2

print('component name=x-s type=ConstantFunctionComponent input-dim={0} output-dim={1} '
'output-mean=0 output-stddev=0 '.format(
args.feat_dim, ((args.output_dim)+(args.output_dim+1))/2), file=f)
args.feat_dim, s_dim), file=f)
print('component-node name=x-s component=x-s input=IfDefined(input)',
file=f)
print('component name=x-s-scale type=FixedScaleComponent dim={0} scale={1}'.format(
Expand All @@ -413,7 +413,7 @@ def WriteConfigs(self, f):
print('component-node name=x-b component=x-b input=IfDefined(input)', file=f)
print('component name=x-b-scale type=FixedScaleComponent dim=1 scale={0}'.format(
args.b_scale), file=f);
print('component-node name=x-b-scale component=x-b-scale input=input',
print('component-node name=x-b-scale component=x-b-scale input=x-b',
file=f)
print('output-node name=b input=x-b-scale', file=f)
f.close()
2 changes: 1 addition & 1 deletion src/nnet3/nnet-general-component.cc
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,7 @@ void StatisticsPoolingComponent::Backprop(
variance_deriv.Scale(0.5);

// the deriv w.r.t. the uncentered variance is the same as w.r.t. the
// uncentered variance (since they difer by a constant term of -(mean *
// uncentered variance (since they differ by a constant term of -(mean *
// mean), but we need to add to dF/dmean, the value -2.0 * mean *
// dF/dvariance.
mean_deriv.AddMatMatElements(-2.0, mean_value, variance_deriv, 1.0);
Expand Down

0 comments on commit c3c99b0

Please sign in to comment.