Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions egs/wsj/s5/steps/nnet3/chain/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,16 +341,16 @@ def train(args, run_opts):
{dir}/init.raw""".format(command=run_opts.command,
dir=args.dir))

egs_left_context = left_context + args.frame_subsampling_factor / 2
egs_right_context = right_context + args.frame_subsampling_factor / 2
egs_left_context = left_context + args.frame_subsampling_factor // 2
egs_right_context = right_context + args.frame_subsampling_factor // 2
# note: the '+ args.frame_subsampling_factor / 2' is to allow for the
# fact that we'll be shifting the data slightly during training to give
# variety to the training data.
egs_left_context_initial = (left_context_initial +
args.frame_subsampling_factor / 2 if
args.frame_subsampling_factor // 2 if
left_context_initial >= 0 else -1)
egs_right_context_final = (right_context_final +
args.frame_subsampling_factor / 2 if
args.frame_subsampling_factor // 2 if
right_context_final >= 0 else -1)

default_egs_dir = '{0}/egs'.format(args.dir)
Expand Down Expand Up @@ -432,7 +432,7 @@ def train(args, run_opts):
num_archives_to_process = int(args.num_epochs * num_archives_expanded)
num_archives_processed = 0
num_iters = ((num_archives_to_process * 2)
/ (args.num_jobs_initial + args.num_jobs_final))
// (args.num_jobs_initial + args.num_jobs_final))

# If do_final_combination is True, compute the set of models_to_combine.
# Otherwise, models_to_combine will be none.
Expand Down
10 changes: 5 additions & 5 deletions egs/wsj/s5/steps/nnet3/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ def AddConvolutionLayer(config_lines, name, input,
components.append(conv_init_string)
component_nodes.append("component-node name={0}_conv_t component={0}_conv input={1}".format(name, input['descriptor']))

num_x_steps = (1 + (input_x_dim - filt_x_dim) / filt_x_step)
num_y_steps = (1 + (input_y_dim - filt_y_dim) / filt_y_step)
num_x_steps = (1 + (input_x_dim - filt_x_dim) // filt_x_step)
num_y_steps = (1 + (input_y_dim - filt_y_dim) // filt_y_step)
output_dim = num_x_steps * num_y_steps * num_filters;
return {'descriptor': '{0}_conv_t'.format(name),
'dimension': output_dim,
Expand Down Expand Up @@ -204,9 +204,9 @@ def AddMaxpoolingLayer(config_lines, name, input,

component_nodes.append('component-node name={0}_maxp_t component={0}_maxp input={1}'.format(name, input['descriptor']))

num_pools_x = 1 + (input_x_dim - pool_x_size) / pool_x_step;
num_pools_y = 1 + (input_y_dim - pool_y_size) / pool_y_step;
num_pools_z = 1 + (input_z_dim - pool_z_size) / pool_z_step;
num_pools_x = 1 + (input_x_dim - pool_x_size) // pool_x_step;
num_pools_y = 1 + (input_y_dim - pool_y_size) // pool_y_step;
num_pools_z = 1 + (input_z_dim - pool_z_size) // pool_z_step;
output_dim = num_pools_x * num_pools_y * num_pools_z;

return {'descriptor': '{0}_maxp_t'.format(name),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,15 +198,15 @@ def process_multilingual_egs(args):
lang_len = lang2len[:]
# total num of egs in all languages
tot_num_egs = sum(lang2len[i] for i in range(len(lang2len)))
num_archives = max(1, min(args.max_archives, tot_num_egs / args.samples_per_iter))
num_archives = max(1, min(args.max_archives, tot_num_egs // args.samples_per_iter))

num_arch_file = open("{0}/info/{1}num_archives".format(
args.egs_dir,
args.egs_prefix),
"w")
print("{0}".format(num_archives), file=num_arch_file)
num_arch_file.close()
this_num_egs_per_archive = tot_num_egs / (num_archives * args.num_jobs)
this_num_egs_per_archive = tot_num_egs // (num_archives * args.num_jobs)

logger.info("Generating {0}scp.<job>.<archive_index> temporary files used to "
"generate {0}<archive_index>.scp.".format(args.egs_prefix))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def run(args):

logger.info("Wrote {num_utts} targets; failed with {num_err}"
"".format(num_utts=num_utts, num_err=num_err))
if num_utts == 0 or num_err >= num_utts / 2:
if num_utts == 0 or num_err >= num_utts // 2:
raise RuntimeError


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def run(args):
"".format(num_reco=num_reco, num_utt=num_utt,
num_utt_err=num_utt_err))

if num_utt == 0 or num_utt_err > num_utt / 2 or num_reco == 0:
if num_utt == 0 or num_utt_err > num_utt // 2 or num_reco == 0:
raise RuntimeError


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ def run(args):
"".format(num_utt=num_utt, num_reco=num_reco,
num_utt_err=num_utt_err))

if num_utt == 0 or num_utt_err > num_utt / 2 or num_reco == 0:
if num_utt == 0 or num_utt_err > num_utt // 2 or num_reco == 0:
raise RuntimeError


Expand Down
4 changes: 2 additions & 2 deletions egs/wsj/s5/steps/segmentation/internal/merge_targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def should_remove_frame(row, dim):
# Remove frame.
return True

best_source = max_idx / dim
best_source = max_idx // dim
best_class = max_idx % dim

confident_in_source = [] # List of length num_sources
Expand Down Expand Up @@ -171,7 +171,7 @@ def run(args):
"is not a multiple of dim {dim}"
"".format(utt=key, f=args.pasted_targets.name,
nc=mat.shape[1], dim=args.dim))
num_sources = mat.shape[1] / args.dim
num_sources = mat.shape[1] // args.dim

out_mat = np.matrix(np.zeros([mat.shape[0], args.dim]))

Expand Down