Skip to content

Commit

Permalink
Increase output dim size
Browse files Browse the repository at this point in the history
  • Loading branch information
reminisce committed Aug 8, 2017
1 parent e48d7e1 commit 229237c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions benchmark/python/sparse_end2end.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
parser.add_argument('--num-gpu', type=int, default=0,
help='number of gpus to use. 0 means using cpu(0);'
'otherwise, use gpu(0),...,gpu(num_gpu-1)')
parser.add_argument('--output-dim', type=int, default=1,
parser.add_argument('--output-dim', type=int, default=4,
help='number of columns of the forward output')


Expand Down Expand Up @@ -178,9 +178,6 @@ def get_sym(feature_dim):
nbatch += 1
batch = next_batch

mod.forward_backward(batch)
# update parameters
mod.update()
# if have kvstore, need to pull corresponding rows of
# the weights to each context
if kv is not None:
Expand All @@ -196,6 +193,10 @@ def get_sym(feature_dim):
row_idx_array.append(row_indices[indptr[s.start]:indptr[s.stop]])
kv.row_sparse_pull('w', weight_array, priority=-index, row_ids=row_idx_array)

mod.forward_backward(batch)
# update parameters
mod.update()

try:
# pre fetch next batch
next_batch = next(data_iter)
Expand Down

0 comments on commit 229237c

Please sign in to comment.