def profile(curr_step, start_step, end_step, profile_name='<STR_LIT>',<EOL>early_exit=True):
if curr_step == start_step:<EOL><INDENT>mx.nd.waitall()<EOL>mx.profiler.set_config(profile_memory=False, profile_symbolic=True,<EOL>profile_imperative=True, filename=profile_name,<EOL>aggregate_stats=True)<EOL>mx.profiler.set_state('<STR_LIT>')<EOL><DEDENT>elif curr_step == end_step:<EOL><INDENT>mx.nd.waitall()<EOL>mx.profiler.set_state('<STR_LIT>')<EOL>logging.info(mx.profiler.dumps())<EOL>mx.profiler.dump()<EOL>if early_exit:<EOL><INDENT>exit()<EOL><DEDENT><DEDENT>
profile the program between [start_step, end_step).