Skip to content

Commit bacf975

Browse files
committed
remove natural gradient
1 parent 3c61cf5 commit bacf975

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

egs/wsj/s5/steps/libs/nnet3/xconfig/basic_layers.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@ def _generate_config(self):
624624
# note: by default the LinearComponent uses natural gradient.
625625
line = ('component name={0}.linear type=LinearComponent '
626626
'orthonormal-constraint={1} param-stddev={2} '
627-
'input-dim={3} output-dim={4} max-change=0.75 {5}'
627+
'input-dim={3} output-dim={4} max-change=0.75 use-natural-gradient=false {5}'
628628
''.format(self.name, self.config['orthonormal-constraint'],
629629
self.config['orthonormal-constraint'] / math.sqrt(input_dim),
630630
input_dim, bottleneck_dim, linear_options))
@@ -637,7 +637,7 @@ def _generate_config(self):
637637

638638

639639
line = ('component name={0}.affine'
640-
' type=NaturalGradientAffineComponent'
640+
' type=AffineComponent'
641641
' input-dim={1} output-dim={2} {3}'
642642
''.format(self.name, cur_dim, output_dim, affine_options))
643643
configs.append(line)
@@ -843,7 +843,7 @@ def _add_components(self, input_desc, input_dim, nonlinearities):
843843
bottleneck_dim = self.config['bottleneck-dim']
844844
# note: by default the LinearComponent uses natural gradient.
845845
line = ('component name={0}.linear type=LinearComponent '
846-
'input-dim={1} orthonormal-constraint=1.0 output-dim={2} {3}'
846+
'input-dim={1} orthonormal-constraint=1.0 output-dim={2} {3} use-natural-gradient=false'
847847
''.format(self.name, input_dim, bottleneck_dim, linear_options))
848848
configs.append(line)
849849
line = ('component-node name={0}.linear component={0}.linear input={1}'
@@ -853,7 +853,7 @@ def _add_components(self, input_desc, input_dim, nonlinearities):
853853
cur_dim = bottleneck_dim
854854

855855

856-
line = ('component name={0}.affine type=NaturalGradientAffineComponent'
856+
line = ('component name={0}.affine type=AffineComponent'
857857
' input-dim={1} output-dim={2} {3}'
858858
''.format(self.name, cur_dim, output_dim, affine_options))
859859
configs.append(line)

egs/wsj/s5/steps/libs/nnet3/xconfig/composite_layers.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ def _generate_config(self):
167167
# The first linear layer, from input-dim (spliced x2) to bottleneck-dim
168168
configs.append('component name={0}.linear type=TdnnComponent input-dim={1} '
169169
'output-dim={2} l2-regularize={3} max-change={4} use-bias=false '
170-
'time-offsets={5} orthonormal-constraint=-1.0'.format(
170+
'time-offsets={5} orthonormal-constraint=-1.0 use-natural-gradient=false'.format(
171171
name, input_dim, bottleneck_dim, l2_regularize,
172172
max_change, time_offsets1))
173173
configs.append('component-node name={0}.linear component={0}.linear '
@@ -176,7 +176,7 @@ def _generate_config(self):
176176
# The affine layer, from bottleneck-dim (spliced x2) to output-dim
177177
configs.append('component name={0}.affine type=TdnnComponent '
178178
'input-dim={1} output-dim={2} l2-regularize={3} max-change={4} '
179-
'time-offsets={5}'.format(
179+
'time-offsets={5} use-natural-gradient=false'.format(
180180
name, bottleneck_dim, output_dim, l2_regularize,
181181
max_change, time_offsets2))
182182
configs.append('component-node name={0}.affine component={0}.affine '
@@ -291,7 +291,7 @@ def _generate_config(self):
291291
self_repair_scale = self.config['self-repair-scale']
292292

293293
# The affine layer, from input-dim to big-dim.
294-
configs.append('component name={0}.affine type=NaturalGradientAffineComponent '
294+
configs.append('component name={0}.affine type=AffineComponent '
295295
'input-dim={1} output-dim={2} l2-regularize={3} max-change={4}'.format(
296296
name, input_dim, big_dim, l2_regularize, max_change))
297297
configs.append('component-node name={0}.affine component={0}.affine '
@@ -314,7 +314,7 @@ def _generate_config(self):
314314
# ("floating" orthonormal constraint).
315315
configs.append('component name={0}.linear type=LinearComponent '
316316
'input-dim={1} output-dim={2} l2-regularize={3} max-change={4} '
317-
'orthonormal-constraint=-1 '.format(
317+
'orthonormal-constraint=-1 use-natural-gradient=false '.format(
318318
name, big_dim, small_dim,
319319
l2_regularize, max_change))
320320
configs.append('component-node name={0}.linear component={0}.linear '

egs/wsj/s5/steps/libs/nnet3/xconfig/trivial_layers.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ def _generate_config(self):
328328

329329
configs = []
330330
line = ('component name={0} type=LinearComponent input-dim={1} output-dim={2} '
331-
'{3}'.format(self.name, input_dim, output_dim, opts))
331+
'{3} use-natural-gradient=false'.format(self.name, input_dim, output_dim, opts))
332332
configs.append(line)
333333
line = ('component-node name={0} component={0} input={1}'.format(
334334
self.name, input_desc))

0 commit comments

Comments
 (0)