templates.runner.st Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of caffe-translator Show documentation
Show all versions of caffe-translator Show documentation
Translate Caffe code to MXNet Python code
The newest version!
ctx =
module = mx.mod.Module(symbol=, context=ctx, data_names=[], label_names=[])
module.bind(data_shapes=.provide_data,
label_shapes=.provide_label)
epoch = 1
batch_num = 1
max_iter =
snapshot =
test_interval =
test_iter =
while batch_num \<= max_iter:
.reset()
for batch in :
module.forward(data_batch=batch, is_train=True)
module.backward()
module.update()
train_metrics.process(batch_num, module, batch.label)
if(batch_num % test_interval == 0):
logger.info("Iteration %d, Testing net" % batch_num)
test_metrics.score_and_print(module, , num_batch=test_iter)
if(batch_num % snapshot == 0):
# write snapshot
module.save_checkpoint(prefix="", epoch=batch_num, save_optimizer_states=True)
batch_num += 1
if batch_num > max_iter:
break
stepsize =
gamma =
power =
epoch += 1
logger.info("Training done. Saving model to ")
module.save_checkpoint(prefix="", epoch=batch_num, save_optimizer_states=True)