Skip to content

Commit b1b230c

Browse files
KarelVesely84danpovey
authored andcommitted
[src,scripts] Python2 compatibility fixes and code cleanup for nnet1 (#3113)
1 parent 8cafd32 commit b1b230c

11 files changed

+6
-1385
lines changed

egs/wsj/s5/steps/nnet/train.sh

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -433,18 +433,6 @@ else
433433
${bn_dim:+ --bottleneck-dim=$bn_dim} \
434434
"$cnn_fea" $num_tgt $hid_layers $hid_dim >>$nnet_proto
435435
;;
436-
cnn2d)
437-
delta_order=$([ -z $delta_opts ] && echo "0" || { echo $delta_opts | tr ' ' '\n' | grep "delta[-_]order" | sed 's:^.*=::'; })
438-
echo "Debug : $delta_opts, delta_order $delta_order"
439-
utils/nnet/make_cnn2d_proto.py $cnn_proto_opts \
440-
--splice=$splice --delta-order=$delta_order --dir=$dir \
441-
$num_fea >$nnet_proto
442-
cnn_fea=$(cat $nnet_proto | grep -v '^$' | tail -n1 | awk '{ print $5; }')
443-
utils/nnet/make_nnet_proto.py $proto_opts \
444-
--no-smaller-input-weights \
445-
${bn_dim:+ --bottleneck-dim=$bn_dim} \
446-
"$cnn_fea" $num_tgt $hid_layers $hid_dim >>$nnet_proto
447-
;;
448436
lstm)
449437
utils/nnet/make_lstm_proto.py $proto_opts \
450438
$num_fea $num_tgt >$nnet_proto

egs/wsj/s5/utils/nnet/gen_dct_mat.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
# limitations under the License.
1717

1818
# ./gen_dct_mat.py
19-
# script generates matrix with DCT transform, which is sparse
20-
# and takes into account that data-layout is along frequency axis,
19+
# script generates matrix with DCT transform, which is sparse
20+
# and takes into account that data-layout is along frequency axis,
2121
# while DCT is done along temporal axis.
2222

2323
from __future__ import division
@@ -29,10 +29,7 @@
2929
from optparse import OptionParser
3030

3131
def print_on_same_line(text):
32-
if (sys.version_info > (3,0)):
33-
print(text, end=' ')
34-
else:
35-
print text,
32+
print(text, end=' ')
3633

3734
parser = OptionParser()
3835
parser.add_option('--fea-dim', dest='dim', help='feature dimension')
@@ -69,7 +66,7 @@ def print_on_same_line(text):
6966
if(n==timeContext-1):
7067
print_on_same_line((dim-m-1)*'0 ')
7168
print()
72-
print()
69+
print()
7370

7471
print(']')
7572

egs/wsj/s5/utils/nnet/gen_hamm_mat.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,7 @@
2727
from optparse import OptionParser
2828

2929
def print_on_same_line(text):
30-
if (sys.version_info > (3,0)):
31-
print(text, end=' ')
32-
else:
33-
print text,
30+
print(text, end=' ')
3431

3532
parser = OptionParser()
3633
parser.add_option('--fea-dim', dest='dim', help='feature dimension')

egs/wsj/s5/utils/nnet/gen_splice.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,7 @@
2626
from optparse import OptionParser
2727

2828
def print_on_same_line(text):
29-
if (sys.version_info > (3,0)):
30-
print(text, end=' ')
31-
else:
32-
print text,
29+
print(text, end=' ')
3330

3431
parser = OptionParser()
3532
parser.add_option('--fea-dim', dest='dim_in', help='feature dimension')

egs/wsj/s5/utils/nnet/make_cnn2d_proto.py

Lines changed: 0 additions & 259 deletions
This file was deleted.

0 commit comments

Comments
 (0)